0
double hours=0, rate=0; 
    double Federaltaxes, Ficataxes, Statetaxes;
    double netpay=0, grosspay=0, totaltaxes;
    if (hours <= 40){
    System.out.println("how many hours did you work");
    hours= input.nextDouble();
    System.out.println("what is the rate you get paid");
    rate= input.nextDouble();
    grosspay= hours * rate;
    System.out.println("the gross pay is:" + grosspay);
    Federaltaxes= grosspay * .20;
        System.out.println("Federal taxes are:" + Federaltaxes);
        Ficataxes= grosspay * .10;
        System.out.println("Fica taxes  are:" + Ficataxes);
        Statetaxes= grosspay * .05;
        System.out.println("State taxes are:" + Statetaxes);
        totaltaxes = Federaltaxes + Ficataxes + Statetaxes;
        System.out.println("total taxes paid are:" + totaltaxes );
        netpay= grosspay - totaltaxes;
        System.out.println("net pay is:" + netpay);
    }
    else grosspay= (40*rate) + ((1.5*rate)*(hours-40));
2
Contributors
1
Reply
15
Views
2 Years
Discussion Span
Last Post by oussama_1
0

Put the if statement at the bottom of your code
If (hours >40)
grosspay= (40 * rate) + ((1.5 * rate)*(hours-40));

Edited by oussama_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.