ANSWER WITH JAVA. ONLY ANSWER THIS IF YOU CAN ACTUALLY ANSWER RIGHT NOW. DO NOT
ID: 3687068 • Letter: A
Question
ANSWER WITH JAVA. ONLY ANSWER THIS IF YOU CAN ACTUALLY ANSWER RIGHT NOW. DO NOT SAY YOU WILL ANSWER IN x AMOUNTS OF HOURS. I NEED THEM NOW.
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.
Explanation / Answer
class ta_salary
{
public static double pay(double r, int hr)
{
double net,ro;
int hro;
if(hr>8)
{
hro=hr-8;
ro=(r*1.5);
net=8*r+hro*ro;
}
else
{
net=hr*r;
}
return net;
}
public static void main(String args[])
{
double net=pay(4.00, 11);
System.out.println("Net pay of week is "+net);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.