Programming Problem Write a C++ program to calculate the pay for an employee. Th
ID: 3552473 • Letter: P
Question
Programming Problem
- Write a C++ program to calculate the pay for an employee.
- The program inputs the pay rate and the number of hours worked from the user.
- The program echoes the input information and outputs the calculated pay.
- Include a void function, called GetData, which takes two arguments and inputs the pay rate and the number of hours worked.
- Include another value returned function, called CalcPay, which takes two arguments and returns the total pay for that employee.
- Include a final void function, called PrintPay, which takes three arguments and outputs the input information and the calculated total pay.
- The sample output for the program should looks like the following:
This program calculates total pay for an employee. please enter pay rate per hour: 15.66 Please enter hours worked: 200.5 For an employee who worked 200.5 hours with a pay rate $ 15.66 per hour, The total pay is $ 3139.83. Press any key to continue . . .
Explanation / Answer
Here it is, please rate! #include using namespace std; void getData(double, double); double calcPay(double, double); void printPay(double, double, double); double payRate, hoursWorked, totalPay; int main() { getData(payRate, hoursWorked); totalPay = calcPay(payRate, hoursWorked); printPay(payRate, hoursWorked, totalPay); return 0; } void getData(double pr, double hw) { cout > pr; cout > hw; payRate = pr; hoursWorked = hw; } double calcPay(double pr, double hw) { return pr*hw; } void printPay(double pr, double hw, double tp) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.