Question
If an employee has worked forty hours or less, the pay is just the number of hours worked multiplied with the hourly wage. If he
If an employee has worked forty hours or less, the pay is just the number of hours worked multiplied with the hourly wage. If he has worked more than forty hours, he qualifies for overtime pay, which is his regular 40-hour pay plus 1.5 times his hourly wage times the overtime hours.
For example, if Cassie is paid ten dollars an hour and works only twenty hours, then her pay is two hundred dollars (or ten dollars/hour times twenty hours).
But if Ben is paid eight dollars an hour and works for fifty hours, his pay is three hundred sixty dollars regular pay (eight dollars/hour times forty hours) PLUS one hundred twenty dollars for overtime pay (1.5 times eight dollars/hour times ten hours overtime), making his total pay four hundred and forty dollars.
Complete the following file:
ComputePay.java
public class ComputePay { /** Compute pay (including overtime) for worker. Hours in excess of 40 hours are paid at time-and-a-half. @param wage the hourly wage for the employee @param hoursWorked the number of hours worked by employee in one week @return the amount of pay employee earned */ public static double payForWeek(double wage, double hoursWorked) { ... } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started