Question: Instruction: 1) A flowchart (PDF version) 2) Source code (.java) version Question 1 A&N 24-hour mini-mart wants you to write a Java program to calculate
Instruction: 1) A flowchart (PDF version) 2) Source code (.java) version
Question 1
A&N 24-hour mini-mart wants you to write a Java program to calculate the stores weekly payroll. The stores employees are paid hourly. Overtime is to be paid at the rate of 1.5 times the normal rate for hours an employee worked over 40.
The program should prompt (ask) the user to enter the number of hours the employee worked and the pay rate for the employee. The program should display the regular pay, overtime pay, and the gross pay (regular pay + overtime pay) for that employee.
Then the program should prompt the user to enter the data for another employee. When the user responds that there are no more employee to process (hint: use sentinel value), the program should display the number of employees it processed and the total payroll (the sum of the gross salaries of the employees).
The program should validate the pay rate as it is entered. The only valid pay rates are the following: 3.50, 4.00, 4.50, 4.75, 5.00, 5.25, 5.50, 5.75, 6.00. Store the rates in the array. When a pay rate is entered, search the array for a match. If there is a match, continue with the rest of the calculations. If there is no match, display an error message, a list of the valid pay rates, and prompt for another pay rate.
A very simple input/output:
Enter hours work: 45
Enter pay rate: 8
Invalid Pay Rate! Valid Pay Rates are: 3.5 4.0 4.5 4.75 5.0 5.25 5.5 5.75 6.0
Enter pay rate: 7
Invalid Pay Rate! Valid Pay Rates are: 3.5 4.0 4.5 4.75 5.0 5.25 5.5 5.75 6.0
Enter pay rate: 6
Regular: 240.0 Overtime: 45.0 Gross: 285.0
Do you have any employee to process (Y/N)? y
Enter hours work: 30
Enter pay rate: 4.75
Regular: 142.5
No overtime pay Gross: 142.5
Do you have any employee to process (Y/N)? Y
Enter hours work: 40
Enter pay rate: 9
Invalid Pay Rate!
Valid Pay Rates are: 3.5 4.0 4.5 4.75 5.0 5.25 5.5 5.75 6.0
Enter pay rate: 5.5
Regular: 220.0
No overtime pay
Gross: 220.0 Do you have any employee to process (Y/N)? n
Total Payroll (Sum):647.5
Total Employee: 3
[Note: The sample input/output show the basic requirements for the program. However, you are expected to produce a much nicer output than the sample. ]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
