Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- {
- if(hoursWorked > 40)
- {
- return wage*40 + (wage*1.5*(hoursWorked - 40));
- }
- return wage*hoursWorked;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement