# Help me with beginner coding

• March 29th, 2014, 12:53 AM
sandielee
Help me with beginner coding
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
• March 29th, 2014, 03:50 AM
GregBrannon
Re: Help me with beginner coding
Welcome to the forum! Please read this topic to learn how to post code correctly and other useful info for new members.

You forgot to program for the case y < hours.
• March 29th, 2014, 10:09 AM
lil_misfitss
Re: Help me with beginner coding
Welcome to the Forum! I'm new too! (actually relearning java XD) I'll see if I can help!
So X = what the TA is getting paid and Y is the number of hours?

--- Update ---

` // code removed by GB`