The folks at Babbage's Cabbage's have asked that some additional "business logic" be integrated into the payroll program you created for them, and would also like to be able to process more than one employee at a time. The number of hours worked by an employee cannot be less than 20.0 hours, or more than 60.0 hours; their hourly rate also cannot be less than $7.25, or more than $44.99. Employees are paid at different rates for regular vs. overtime hours. Regular hours are those worked up to and including the first 40 hours per week. Overtime hours are those worked in excess of the first 40 hours per week. Gross pay is the sum of wages earned from regular hours and overtime hours, but overtime is paid at 1.5 times the regular rate.

Program Updates

Modify the program you created in Lab Assignment #5 (Babbage's Cabbage's, Part 1) to limit the range of user inputs, account for regular vs. overtime hours, and allow the user to process more than one employee. Keep in mind that bounds on the number of hours worked, hourly rate, and the number of hours at which overtime kicks in are subject to change over time, and thus must be easy to modify in the source code.

1. Update the module you use to read input from the user to ensure that the hours worked and hourly rate are both in range. When an input is out of bounds, the user should be prompted to reenter the value. (See the sample run for the flow and wording of error messages.)

2. Add a module that splits the number of hours worked into regular hours and overtime hours. This module must have one 'in' parameter and two out parameters.

3. Call the module you created in the previous item before you calculate the gross pay, and modify your gross pay module so the calculation is based on regular and overtime hours:

gross_pay <- ( regular_hours x hourly_rate ) + ( overtime_hours x ( hourly_rate x 1.5) )

Also modify your output module to display the hours worked split into regular and overtime.

4. Allow the user of the program to input data for more than one employee. Once an employee has been processed, prompt the user with "Process another employee (Y/N)?". If the user responds with 'Y' or y, the program repeats for the next employee. If the user responds with N or n, the program ends. For any other input (assume the user always types a single character), the program reminds the user to Please type Y for yes or N for no and again asks Process another employee (Y/N)?.

Sample Run

The sample run below gives an example of the general flow of the program, and provides details on the desired wording of prompts, error messages, and output formatting. Input supplied by the user appears in underlined bold. When given the same inputs, your program should match the output of the sample run exactly.

You do not need to underline the user's input or display it in bold. This is simply a convention to help distinguish between the output of your program and the user's input; both will appear on the screen in the same plain style.

A "formatting guide" has been provided in the first sample to help indicate the width, alignment, and number of decimal places for each field, as well as spacing between fields. This guide will become more useful during the implementation phase, and should be omitted from the output.

Enter employee's first name: Horace
Enter employee's last name: Horsecollar
Enter number of hours worked: 38
Enter hourly pay rate: 12.50

12345678901234567890##21.00##21.00##321.00##4321.00##321.00##321.00##4321.00
Reg Ovt Hourly Gross Net
Name Hours Hours Rate Pay Taxes Deduct Pay
==================== ===== ===== ====== ======= ====== ====== =======
Horsecollar, Horace 38.00 0.00 12.50 475.00 133.00 7.50 334.50


Process another employee (Y/N)? U
Please type 'Y' for yes or 'N' for no

Process another employee (Y/N)? y

Enter employee's first name: Rachel
Enter employee's last name: Reins
Enter number of hours worked: 146.5
The number of hours worked must be between 20.00 and 60.00

Enter number of hours worked: 46.5
Enter hourly pay rate: 114.40
The hourly pay rate must be between 7.25 and 44.99

Enter hourly pay rate: 444.40
The hourly pay rate must be between 7.25 and 44.99

Enter hourly pay rate: 14.40

                     Reg   Ovt   Hourly Gross                 Net
Name Hours Hours Rate Pay Taxes Deduct Pay
==================== ===== ===== ====== ======= ====== ====== =======
Reins, Rachel 40.00 6.50 14.40 716.40 200.59 7.50 508.31


Process another employee (Y/N)? Y

Enter employee's first name: Samuel
Enter employee's last name: Saddle
Enter number of hours worked: 51
Enter hourly pay rate: 40.00

                     Reg   Ovt   Hourly Gross                 Net
Name Hours Hours Rate Pay Taxes Deduct Pay
==================== ===== ===== ====== ======= ====== ====== =======
Saddle, Samuel 40.00 11.00 40.00 2260.00 632.80 7.50 1619.70


Process another employee (Y/N)? n

Deliverables

You must update the Analysis and Design document you created for Lab Assignment #5, incorporating changes made for this assignment. Implement your updated program analysis and design with source code written in C/C++.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.