Description

Hourly Wage Calculator Summary Write a program that will calculate two weeks of hourly pay for an individual. Payment will depend on the actual hours worked, overload, and the week of the year the hours were worked. The results will be displayed to the user.

Overall Requirements

  • From the user, get the number of the week worked.
  • From the user, get the hours worked for the week. User should enter seven double values.
  • Standard pay rate is $15.00 / hour.
  • Overtime pay is 1.5 times the standard pay, for hours worked over 40 hours per week.
  • High demand pay is an additional $2.00 / hour, or $17.00 / hour.
  • High demand pay will be calculated for Weeks 1, 2, 44-52.
  • Allow user to calculate wages for another week. Functional requirements:
  • Declare the following constant variables to utilize in your program:
    • HOUR_RATE, double, equal to 15.00
    • BONUS_RATE, double, equal to 2.00
    • OVERLOAD_PERCENT, double, equal to 1.5
    • REGULAR_HOURS, double, equal to 40.0
  • Validate the week entered (week should be between 1 and 52). If a user enters an invalid week, output a short message and ask them to enter a week number again.
  • An invalid week should produce a short error "Week must be between 1 and 52, please try again."
  • The system will loop until a valid value is entered. If the user enters -1, the program should end.
  • Validate the hours entered for the week.
  • If the user enters more or less than 7 values, instruct the user to try again.
  • If the user enters non-numeric values, instruct the user to try again. *** I will give you some sample code for this!
  • If the user enters a negative value or a value greater than 15, instruct the user to try again.
  • Calculate the payment for the week.
  • Add the number of hours worked for the week.
  • Up to 40 hours will be calculated using the base rate.
  • Hours over 40 will be calculated using the overtime pay of 1.5. For example if a person works 45 hours, 40 would be calculated at the base rate, and 5 will be calculated at overtime rate.
  • If the week worked is a high-demand week (1,2, 44-52), add $2.00 to the base rate.
    • A year has 52 weeks, Week 1 is the first week of January, Week 52 is the last week of the year. For examples on how week numbers map every year: https://www.epochconverter.com/weeknumbers.
  • Display the total pay for the week in USD with 2 decimals.
  • Display a breakdown of the payment.
    • The total regular hours worked, and the rate applied.
    • The total of the base rate pay.
    • The total of overtime hours worked, and the overtime rate applied.
    • The total of the overtime pay.
  • Allow the user to enter hours for another week. Organizational requirements:
  • The main method should help as your focus to control the algorithm.
  • Your code should use multiple methods to delegate the work that has to be done.
    • main(): should control the overall program, a starting java file is provided.
    • getInputFromUser() should take as a parameter a Scanner variable and an integer value for the week number. The method should return an array of type double. This method will ask user to input the hours work for the week, call the validateInput() method. The method should continue to ask the user as long as the validateInput() method returns false. Once the values are found to be valid, the method should call convertStringArrayToDouble() to get an array containing all the valid values.
    • validateInput() should take as a parameter an array of type String, and return a boolean indicating whether the input is valid (true) or not (false). This method should validate that all the values meet the conditions, if any invalid condition is found, the method returns false. If all values are valid, the method returns true.
    • convertStringArrayToDouble() should take as a parameter an array of type String, and return an array of type double. The method will take each value in the string array, convert it to double and put it into the numeric array.
    • calculatePayForWeek() should take as a parameter an integer value for the week, and an array of type double; the method does not return any values (void). The method will perform and display all the wage calculations. It should call getTotalHours() to obtain the sum of the hours worked. This method should use if statements to identify the different conditions (regular, overtime and bonus)
    • getTotalHours() should take as a parameter an array of type double and return an integer value equal to the sum of all the hours worked.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.