Friday, September 26, 2014

Assume that an object represents an employee report that contains the information like employee id , total bonus, total overtime in a particular year. Use array of objects to represent n employee’s reports. WAP that displays report. Use setreport() member functions to set report attribute by passing the arguments and member functions displayreport() to show the reports according to parameter passed. Display the report in following format. Employee with ________ has received Rs._____ as bonus and had worked____hours as an overtime in year_______.

#include
#include
#include

class employee
{
int bonus;

public:

setreport(int ot)
{
 bonus=ot*500;
 return(bonus);
}

void displayreport(int id,int year,int b,int ot)
{
cout<
}
};



void main()
{
clrscr();
int n,id,year,ot,b;
cout<
cin>>n;
employee a[50];
for(int i=0;i
{
cout<
cin>>id;
cout<
cin>>year;
cout<
cin>>ot;
}

for(i=0;i
{
b=a[i].setreport(ot);
a[i].displayreport(id,year,b,ot);
}
getch();

}

No comments:

Post a Comment