Question: Following is a complete code that I did: Public class Main { public static void main ( String [ ] args ) { int hours

Following is a complete code that I did:
Public class Main{
public static void main( String[] args){
int hours =40;
double grossPay, payRate =25.0;
double fedTaxRate =0.15, fedTax;
double stateTaxRate =0.05, stateTax, netPay;
grossPay = hours * payRate;
fedTax = fedTaxRate * grossPay;
stateTax = stateTaxRate * grossPay;
netPay = grossPay - fedTax - stateTax;
System.out.println("Gross pay = $ "+ grossPay +
"
Federal tax = $ "+ fedTax +"
State tax = $ "+ stateTax +
"
Net pay = $ "+ netPay);
}
}
Assignment 4a
Rewrite the above problem with its full code and include four additional methods
called, getGrossPay, getFedTax, getStateTax and getNetPay.
Pass the variables, hours and pay_rate from main method to each
of the four methods, compute values and return them back to the
main method to print values.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!