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




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). --------------- I'm in over my head here, class is moving too fast for me, don't really know what I'm reading. I seen a few posts on here for this exact question but its asking for a file that isn't part of the answer, so I do not know if that code is even working. This was my last code for this project,


----------------------------------------------


#include "stdafx .h"


#include


#include


#include


#include


using namespace std;


class payroll


{


If stream fin;


char employ eid [15];


char employ e name[20];


char marital status;


int hours worked, overtime;


double hourly rate, over time pay, regular pay, gross pay, tax rate, tax amount, net pay, sum=0;


void calculate gross pay();


void calculate tax();


void calculate net pay();


void print headings();


void print data();


public :payroll();



~payroll();



void print report();


};


payroll::payroll() {


fin. open("payroll.dat.txt");


}//constructor


payroll::~payroll() {


fin. close();


}//Destructor


void payroll::calculate gross pay() {


if (hours worked > 40) {


overtime = hours worked - 40;


regular pay = hours worked*hourly rate;


overtime e pay = overtime*(hourly rate *1.5);


gross pay = regular pay + overtime pay;


}//if


else gross pay = hours worked *hourly rate;


}//calculate gross pay


void payroll::calculate tax() {


tax rate = .30;


if (marital status == 'S' || marital status == 's')


tax rate = tax rate + .05;


tax amount = gross pay *tax rate;


}//calculate tax


void payroll::calculate e net pay() {


net pay = gross pay – tax amount; //calculate net pay


}


void payroll::print the a dings() {


count <><><>


count <><>


count <><>


count <><>


}//print headings


void payroll::print data() {


count <><>


count <><><><><><><><><><><><><><><><><><><>


}//print data


void payroll::print report() {


int i = 0;


print headings();


while (fin >> employee name >> employed >> marital status >> hours worked >> hourly rate) {


calculate gross pay();


calculate tax();


calculate net pay();


print data();


i++;


sum += net pay;


}//while


count <><><>


count <><><><><>


}//print report


int main()


{


payroll employee;


employee .print report();


system("pause");


return 0;


}



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here