Question: Add sum and average into this program to calculate the net pay and then run it Make the sum and average thier own methods #include

Add sum and average into this program to calculate the net pay and then run it
Make the sum and average thier own methods #include
#include
#include
using namespace std;
class payroll{
ifstream fin;
char employeeid[12];
char employeename[20];
char maritalstatus;
int hoursworked,overtime;
double hourlyrate,overtimepay,regularpay,grosspay,taxrate,taxamount,netpay;
void calculategrosspay();
void calculatetax();
void calculatenetpay();
void printheadings();
void printdata();
public: payroll();
~payroll();
void printreport(); };
payroll::payroll(){
fin.open("payroll.dat"); }//CONSTRUCTOR
payroll::~payroll(){
fin.close(); }//DESTRUCTOR
void payroll:: calculategrosspay(){
if(hoursworked >40){
overtime = hoursworked -40;
regularpay = hoursworked * hourlyrate;
overtimepay = overtime *(hourlyrate *1.5);
grosspay = regularpay + overtimepay; }//IF
else grosspay = hoursworked * hourlyrate; }//CALCULATEGROSSPAY
void payroll ::calculatetax(){
if(grosspay >=500) taxrate =.30;
else if(grosspay >200.00) taxrate =.20;
else taxrate =.10;
if(maritalstatus =='S'||maritalstatus =='s')
taxrate = taxrate +.05;
taxamount = grosspay * taxrate; }//CALCULATETAX
void payroll :: calculatenetpay(){
netpay = grosspay - taxamount; }//CALCULATENETPAY
void payroll::printheadings(){
cout<>employeename>>employeeid>>maritalstatus>>hoursworked>>hourlyrate){
calculategrosspay();
calculatetax();
calculatenetpay();
printdata();
i++; }//WHILE
}//PRINTREPORT
void main(){
payroll employee;
employee.printreport(); }//MAIN

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!