[SOLVED] WeeklyPay program

15.00 $

Programming resource
, Digital learning resource
Categories: ,
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

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 employee’s 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 employee’s name: Homer Simpson
Enter employee’s hourly rate: 19.75

Enter day 1 hours: 8.5
Enter day 2 hours: 9.25
Enter day 3 hours: 8
Enter day 4 hours: 8.25
Enter day 5 hours: 8

Homer Simpson earned $849.25

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.