Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a program WeeklyPay that prompts the user for the name of an employee, the hourly pay , and the hours that the employee worked

Design a program WeeklyPay that prompts the user for the name of an employee, the hourly pay, and the hours 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 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

What are HR ethics?

Answered: 1 week ago

Question

What does corporate sustainability mean?

Answered: 1 week ago