Question: Write a static method named tax that accepts a salary as a parameter and that returns the amount of federal tax you would owe if

Write a static method named tax that accepts a salary as a parameter and that returns the amount of federal tax you would owe if you make that salary. The tax is computed based on your tax bracket as found from the first two columns below. Once you know which row of the table to use, start with the "flat amount" and add the "plus %" of the amount over the amount listed in the final column. For example, if your income is $50,000, then you use the third row of the table and compute the tax as $4,000 plus 25% of the amount over $29,050, which comes to $9,237.50. The total tax on $27,500 is $3,767.50. For $6,000, the tax is $600. For $120,000, the tax is $28,227.

over

but not over

flat amount

plus %

of excess over

$0

$7,150

$0

10%

$0

$7,150

$29,050

$715

15%

$7,150

$29,050

$70,350

$4,000

25%

$29,050

$70,350

unlimited

$14,325

28%

$70,350

You may assume that your method is passed a value greater than or equal to 0. Finish the following code file:

public class TestTax {

public static void main(String[] args) {

System.out.println("The tax on $50000 is " + tax(50000)); // 9237.5

System.out.println("The tax on $27500 is " + tax(27500)); // 3767.5

System.out.println("The tax on $6000 is " + tax(6000)); // 600.0

System.out.println("The tax on $120000 is " + tax(120000)); // 28227.0

}

// your code goes here

}

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!