// Pay program #include using namespace std; int getInfo(int &hrsWorked, double &hrlyRate); void calcPay(int hours, double rate, double ®Pay, double &overPay); void printInfo(double regPay,double overPay,double grossPay); const regHours = 40; //constant int main() { double totalReg=0.00, totalOver=0.00; int hrsWorked; double hrlyRate; double regPay, overPay; while (getInfo(hrsWorked, hrlyRate)) { calcPay(hrsWorked, hrlyRate,regPay, overPay); printInfo(regPay,overPay,overPay+regPay); totalReg+=regPay; totalOver+=overPay; } // while cout<<"TOTAL PAYROLL\n"; printInfo(totalReg,totalOver,totalReg+totalOver); return 0; } // main int getInfo(int &hrs, double &rate) // Reads hourly rate. If hourly rate is greater than 0, read hours // worked and returns true, otherwise returns false to signal end of data. { cout<<"Enter hourly rate: "; cin>>rate; // rate is already an address: NO & !!! if (rate > 0.00) { cout<<"Enter hours worked: "; cin>>hrs; // hrs is already an address: NO & !!! return 1; } // person read in else return 0; //rate of 0 signals end of data } // getInfo void overtime(int hours,double rate,double ®Pay,double &overPay) // pay for emp worked more than reg hours. { int overHours; double overRate; regPay = rate * regHours; overHours = hours - regHours; overRate = rate * 1.5; // time and a half overPay = overHours * overRate; } // overtime void regular(int hours,double rate,double ®Pay,double &overPay) // pay for emp did not work overtime { regPay = rate * hours; overPay = 0.00; } // overtime void calcPay(int hours,double rate,double ®Pay,double &overPay) // call either overtime or regular to calc. Pay { if (hours > regHours) overtime(hours, rate, regPay, overPay); else regular(hours, rate, regPay, overPay); } // calcPay void printInfo(double regPay,double overPay,double grossPay) { cout.precision(2); //print 2 decimal places cout.setf(ios::fixed); cout<<"Regular pay= "<