Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Expand the Employee Payroll program to include hourly based and salary based emp

ID: 3560365 • Letter: E

Question

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, andpolymorphism 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).

Explanation / Answer

#include #include #include using namespace std; class payroll{ ifstream fin; public: string employeename; char paystat; int n; int hoursworked,overtimehours; double hourlyrate,regularpay, minnp, maxnp; double overtimepay,grosspay,taxrate,taxamount,netpay; double totalnetpay, avgnetpay; virtual double findgrosspay(); virtual double calculatetax(); virtual double calculatenetpay(); virtual double findavgnetpay(); void printmax(double, double); void sortbypointers(void); payroll(); ~payroll(); void printreport(); }; 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; }//findgrosspay }; class salaried:public payroll{ public: double findgrosspay(){ if(hoursworked>0){ overtimepay=hoursworked*(regularpay/52/40); regularpay=hourlyrate/52; grosspay=regularpay+overtimepay; }//IF return grosspay; }//findgrosspay }; fin.open("salariedemployees.in");} payroll::~payroll(){ fin.close();} double payroll::calculatetax(){ taxrate=.30; taxamount=grosspay*taxrate; return taxamount; }//findtaxamount }; double payroll::calculatenetpay(){ netpay=grosspay-taxamount; totalnetpay=totalnetpay+netpay; return netpay; }//calculatenetpay }; double payroll::findavgnetpay(){ avgnetpay=totalnetpay/n; std::cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote