Write a method named pay that accepts a real number for a TA's salary and an integer for the number of hours the TA worked this week, and returns how much money to pay the TA. For example, the call pay(5.50, 6) should return 33.0.
The TA should receive "overtime" pay of 1 ½ normal salary for any hours above 8. For example, the call pay(4.00, 11) should return (4.00 * 8) + (6.00 * 3) or 50.0.
my code
public double pay(double x,int y){
double sum=0;
double hours=8.0;
if(y>hours){
sum=(y-hours)*(1.5*x) + (hours*x);
}
return sum;
}
# name expected return your return result
1 pay(5.5, 6) 33.0 0.0 icon fail
2 pay(4.0, 11) 50.0 50.0 icon pass
3 pay(10.0, 40) 560.0 560.0 icon pass
4 pay(0.25, 7) 1.75 0.0 icon fail
5 pay(0.0, 20) 0.0 0.0 icon pass
6 pay(9.0, 0) 0.0 0.0 icon pass
sigh help me