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...
What are the criteria for deciding whether a system should be prototyped?
What will be an ideal response?
When using PowerShell, what cmdlet can be utilized to retrieve a list of services?
A. Retrieve-services B. Get-Service C. List-Service D. Show-Services
When practicing a presentation, write a script so that the presentation can be read to the audience.
Answer the following statement true (T) or false (F)
If you visit a web page and then type another url in the address bar and press Enter, how do you return to the original web page with one click?
A. Click Reload B. Click Forward C. Click New tab D. Click Back