Answer to Question #65450 in Java | JSP | JSF for gazibo

Question #65450
3. Write a class that contains variables that hold your hourly rate of pay and the number of hours that you worked. Display your gross pay, your tax please refer in the table below and your net pay (gross pay – tax).

Grosspay Tax
Below 2000 No tax
2001 - 3000 5%
Above 3000 10 %
1
Expert's answer
2017-02-22T10:04:05-0500
class GrossPay{
double hourlyRate = 0;
double hoursWorked = 0;

public void displayGrossPay(){
double grossPay = hourlyRate*hoursWorked;
System.out.println("Gross pay : " + grossPay);
if(grossPay > 2000 && grossPay < 3000){
grossPay*=0.95;
System.out.println("Tax: " + grossPay*0.05);
} else if(grossPay > 3000){
grossPay*=0.9;
System.out.println("Tax: " + grossPay*0.1);
} else {
System.out.println("Tax: 0");
}
System.out.println("Net pay " + grossPay);
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS