Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!