Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program Wages.java , that will read from the user and: employer's name check in time, check out time and pay per hour and

Write a program Wages.java, that will read from the user and:

  • employer's name
  • check in time,
  • check out time and
  • pay per hour

and calculate the wages earned by the worker. Your program should do the following:

  • Read the employee's name. For this you should validate that the name is at least non-blank 3 characters long.
  • Read the check-in time. Time should be entered in military format. For example if the employee checked in at 8:15 am you should verify that it is entered either as 0815 or 815.
  • Read the check-out time. Time should be entered in military format. For example if the employee checked out at 5:22 pm you should verify that it is entered as 1722.
  • You should verify that the work hours given are only between 8am and 7pm (between 800 and 1900). If the user makes a mistake entering an invalid time, you should print an error message and the input should be requested again.
  • Keep in mind that minutes can only go up to 59 therefore 1760 is an invalid time, while 1759 is valid.
  • Read the pay per hour. Verify that the pay is a value between 8.50 and 49.99 dollars per hour. If the pay is not within this range (inclusive) you should print an error message and ask again.
  • Once you have all the needed information you will calculate the hours worked, then multiply the hours worked by the pay per hour in order to calculate the total pay.
  • You will print all the information in a user friendly format. For example:
     Employee Name: Joe Johnson Check in time: 800 Check out time: 1500 Pay per hour: $10.25 Total pay: $71.75 
  • Keep in mind that subtracting times will be tricky. You should account for cases like: check in time: 850 check out time: 1205 which results in a working time 3 hours and 15 min 15 minutes are .25 of an hour to calculate the total pay you will (in this case) multiply 3.25 by the pay per hour
  • You should not allow cases where the check out time are earlier or equal than the check in time.
  • Your program should run for several employees. It should ask the user when to stop. Use a loop.

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago