Question: Case Study: Phase 1) Create an Employee class for a basic payroll program to compute the net pay salary of hourly based employees. Your program

Case Study:

Phase 1)

Create an Employee class for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees that work over 40 hours will receive overtime pay of one and a half of their hourly rate for overtime hours worked. The output should display the name of each employee, hours worked, hourly rate, overtime pay, regular (gross) pay, tax amount, and net pay. The average net pay of all employees should also be displayed.

//Here's my code and payroll.dat file so far. WHY IS MY OUTPUT COMING BACK WITH HUGE #'S FOR TAX AND NETPAY??? I also need help add in sum of netpay and avg of netpays.... PLEASE HELP !!!

"payroll.dat"

1225 S Saverio Smith 45 20 7995 H Michelle Smith 50 20 8716 m Santino Smith 35 30 1512 s Nicholas Smith 30 12 1513 M Julianna Smith 42 24

#include #include #include using namespace std; class payroll{ ifstream fin; long int employeeid; char marital; string firstname, lastname; double hourlyrate, grosspay, netpay, taxrate, mtaxrate, taxamount, regpay, otpay; int hoursworked, othours; void computeotp(); void computegp(); void computetaxrate(); void computemtaxrate(); void computenetpay(); void printheadings(); void printdata(); public:payroll(); ~payroll(); void printreport(); }; payroll::payroll(){ fin.open("payroll.dat"); }//CONSTRUCTOR payroll::~payroll(){ fin.close(); }//DESTRUCTOR void payroll::computeotp(){ if (hoursworked > 40) othours = hoursworked - 40; //COMPUTE ALL OVERTIME HOURS/PAY otpay = othours * (hourlyrate * 1.5); if (hoursworked 1000) taxrate = 0.30; else if((grosspay > 800) && (grosspay 500) && (grosspay = 0) && (grosspay >employeeid>>marital>>firstname>>lastname>>hoursworked>>hourlyrate) { computeotp(); computegp(); computetaxrate(); computemtaxrate(); computenetpay(); printdata(); i++; }//WHILE } int main(){ payroll employee; employee.printreport();

}//MAIN

Case Study: Phase 1) Create an Employee class for a basic payroll

PAYROLL REPORT- EMP ID MARTIAL STAT FIRST NAME LAST NAME HW HR OTH OTP REGP GROSS TAX NET Saverio Smith 45 20 0 150 900 10503. 35881e-256-3.35881e+256 1225 Michelle Smith 50 20 0 300 1000 13004.15852e +256 -4.15852e+256 7995 Smith 35 30 0 0 1050 10503 .35881e-256-3.35881e+256 8716 Santino s Nicholas Smith 30 12 0 0 360 3601.15159 +256-1.15159e+256 1512 M Julianna Smith 42 24 0 72 1008 10803 .45477e-256-3.454 77e+ 256 1513

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!