Design a program WeeklyPay that prompts the user for the name of an employee, the hourly pay, and thehours that the employee worked on each day of the week (M-F). You MUST use a COUNTER-CONTROLLED WHILE LOOP to read in the hours worked for each day (M-F).
An employee earns an overtime rate of time and a half for hours over 40. It is possible that an employee might not work on a week day, but the hours worked for a day cannot be negative. You MUST validate the hours worked entered by the user with an if statement use zero for a negative value.
Calculate the employees pay for the week and display it as currency (2 places past the decimal point). Be sure to label the output. Use the command prompt window (terminal) for input/output.
Create the program, then zip the .java file and upload it. You do NOT need to submit a .class file. Place your full name in a comment at the top of the file.
Example:
Enter employees name: Homer SimpsonEnter employees hourly rate: 19.75
Enter day 1 hours: 8.5Enter day 2 hours: 9.25Enter day 3 hours: 8Enter day 4 hours: 8.25Enter day 5 hours: 8
Homer Simpson earned $849.25
Reviews
There are no reviews yet.