Develop a C++ program that uses a while statement to determine the gross pay for each of several employees. The company pays “straight time” for the first 40 hours worked by each employee and pays “time-and-a-half” for all hours worked in excess of 40 hours. You are given a list of the employees of the company, the number of hours each employee worked last week and the hourly rate of each employee. Your program should input this information for each employee and should determine and display the employee’s gross pay.
a) Read the problem statement.
b) Formulate the algorithm using pseudocode and top-down, stepwise refinement. c) Write a C++ program.
d) Test, debug and execute the C++ program.
```
Enter hours worked (-1 to end): 39
Enter hourly rate of the employee ($00.00): 10.00
Salary is $390.00
Enter hours worked (-1 to end): 40
Enter hourly rate of the employee ($00.00): 10.00
Salary is $400.00
Enter hours worked (-1 to end): 41
Enter hourly rate of the employee ($00.00): 10.00
Salary is $415.00
Enter hours worked (-1 to end): -1
```
Top:
Determine the gross pay for an arbitrary number of employees
First refinement:
For each employee
Input the hours worked
Input the hourly rate
Calculate and display worker’s gross pay
Second refinement:
Prompt the user for the hours worked for the first employee
Input the hours worked for the first employee
While the sentinel value (-1) has not been entered for the hours
Prompt the user for the employee’s hourly rate
Input the employee’s hourly rate
If the hours input is less than or equal to 40
Calculate gross pay by multiplying hours worked by hourly rate
Else
Calculate gross pay by multiplying hours worked above forty by 1.5 times the hourly rate and adding 40 hours worked by the hourly rate
Display the employee’s gross pay.
Input the hours worked for the next employee
```
You might also like to view...
Consider the following function definition:
``` void tripler(int& n) { n = 3*n;} ``` a) Nothing is wrong with either bit of code. b) There are not enough initializers for the array. c) There is an illegal index in the loop. d) There are too many initializers in for the array. e) The call to the function requires different syntax.
Tables are great when you need a grid layout on a page for a list of data.
Answer the following statement true (T) or false (F)