Acme Parts runs a small factory and employs workers who are paid one of three hourly rates depending on their shift:
first shift, $17 per hour
second shift, $18.50 per hour
third shift, $22 per hour
Each factory worker might work any number of hours per week; any hours greater than 40 are paid at one and one-half times the usual rate. In addition, second and third shift workers can elect to participate in the retirement plan for which 3% of the worker’s gross pay is deducted from the paychecks.
Write the AcmePay program that prompts the user for hours worked, shift, and, if the shift is 2 or 3, whether the worker elects the retirement (1 for yes, 2 for no). Display:
Hours worked
Hourly pay rate
Regular pay
Overtime pay
Retirement deduction, if any
Net pay.
An example of the program is shown below:
Please enter shift - 1, 2, or 3
2
Please enter hours worked
9
Do you want to participate in the retirement plan?
Enter 1 for Yes and 2 for No.
1
Hours worked is 9.0
Hourly pay rate is 18.5
Regular pay is 166.5
Overtime pay is 0.0
Retirement deduction is 4.995
Net pay is....................161.505