Question: MY assignment is Expand the Employee Payroll program to include hourly based and salary based employees. This phase uses an array of employee objects ,
MY assignment is Expand the Employee Payroll program to include hourly based and salary based employees. This phase uses an array of employee objects, inheritance for different classes of employees, and polymorphism for salary computation. The 52 week yearly salary as well as number of overtime hours worked by a salary based employee is given). For salary based employees, to find the regular (gross) pay for a week, divide the salary by 52. To compute the overtime pay for a salary based employee, first find the hourly rate by dividing the gross pay by 40, and then compute overtime pay. For every employee, overtime pay, tax amount, and net pay must also be computed. In addition, the program should find the minimum and maximum net pay of all employees as well as sort the employees based on their net pay (ascending order). What should be in the text file sariedemployees.in not sure what information needs to be provided to get the output the proffer would like. Please try to go off the code I have. getting this error for my code: 159 32 C:\Users\walter\Documents\MODULE7ATTEMPT9.cpp [Error] no match for 'operator=' (operand types are 'payroll' and 'salaried*') Here is my code: #include#include #include #include using namespace std; class payroll{ ifstream fin; public: string employeename; char paystat; int n; float taxrate; double hoursworked, overtimehours, regularhours; double hourlyrate,regularpay,totalnetpay,minnp,maxnp; double avgnetpay,taxamount,netpay,grosspay,overtimepay; virtual double findgrosspay(); void setvariables(char[],int,char,char,char,double,double); virtual double findtaxamount(); virtual double findnetpay(); virtual double findavgnetpay(); void printheaders(); void printdata(); double minnet(double, int); double maxnet(double, int); void printminmax(double, double); void printreport(); void sortbypointers(); payroll(); ~payroll(); }; class hourly: public payroll{ public: double findgrosspay(){ if(hoursworked > 40){ overtimehours=hoursworked-40; regularpay=hoursworked*hourlyrate; overtimepay=overtimehours*(hourlyrate*1.5); grosspay=regularpay+overtimepay;} else{ grosspay=hoursworked*hourlyrate; regularpay=grosspay; return grosspay; }//IF };//findgrosspay }; class salaried:public payroll{ public: double findgrosspay(){ if(hoursworked>0){ overtimepay=hoursworked*(regularpay/52/40); regularpay=hourlyrate/52; grosspay=regularpay+overtimepay; return grosspay; }//If };//findgrosspay }; payroll::payroll(){ fin.open("salariedemployees.in"); } payroll::~payroll() { fin.close();} double payroll::findtaxamount(){ taxrate=.30; taxamount=grosspay*taxrate; return taxamount; }//findtaxamount double payroll::findnetpay(){ netpay=grosspay-taxamount; totalnetpay=totalnetpay+netpay; return netpay; }//findnetpay double payroll::findavgnetpay(){ avgnetpay=totalnetpay/n; cout< p[j+1]){ temp=p[j]; p[j]=p[j+1]; p[j+1]=temp; sortedflag=0; }//SWAP }//J }//I cout< >employeename>>paystat>>hoursworked>>hourlyrate){ findgrosspay(); findtaxamount(); findnetpay(); printdata(); sortbypointers(); n++; }//WHILE findavgnetpay(); cout<<"The average net pay for "< >aemployeename>>apaystat>>ahoursworked>>ahourlyrate){ if(apaystat=='s'){ employee[n]=new salaried(); employee[n]->setvariables(aemployeename,apaystat,ahoursworked,ahourlyrate); employee[n]->findgrosspay(); }//if s if(apaystat=='h'){ employee[n]=new hourly(); employee[n]->setvariables(aemployeename,apaystat,ahoursworked,ahourlyrate); employee[n]->findgrosspay(); }//if h n++; }//WHILE sortnetpays(netpay,n); fin.close(); system ("pause"); }//MAIN
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
