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

In C++ Expand the Employee Payroll program to include hourly based and salary ba

ID: 666748 • Letter: I

Question

In C++

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

Explanation / Answer

#include #include #include // strcmp, exit, etc. #include // for setw using namespace std; /* employee class represents one employee's information. Name, address, dependants hours worked, and other information needed to calculate payroll are encapsolated in this class. The original data file example used full state names, but the current data file does not. This class will keep a longer buffer for compatibility reasons. */ class employee { private: char lname[25]; // last name char fname[25]; // first name char address[25]; // address field char city[25]; // city char state[25]; // full state name or abbrev.. e.g. Michigan or MI char zip[6]; // five digit zip code char type; // hourly or salary int payrate; // per hour or yearly depending on type filed. int hours; // hours worked.. e.g. 80 int dependents; // number of dependants.. could be several if children, etc. int grosspay; // what did we make. int fedwith; // federal withheld int statewith; // state int socsec; // social security int netpay; // net pay ( gross - taxes ) // private member functions for calculation void calcGrossPay(); void calcFedWithhold(); void calcStWithhold(); void calcSocialSec(); void calcNetPay(); // overloaded operators friend istream & operator>>( istream &, employee & ); friend ostream & operator