Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The United States federal personal income tax is calculated based on filing stat

ID: 3852342 • Letter: T

Question

The United States federal personal income tax is calculated based on filing

status and taxable income. There are four filing statuses: single

filers

,

married filing jointly, married filing separately, and head of household. The

tax rates

vary every year. Table 3.2 shows the rates

for 200

9

. If you are,

say, single with a taxable income of $10,000, the first $

8

,

35

0 is taxed at

10% and the other $

1

,

65

0 i

s taxed at 15%. So

,

your tax is $1,

082

.

5.

Table

1

200

9

U.S. Federal Personal Tax Rates

Marginal

Tax Rate

Single

Married Filing Jointly or

Qualified Widow(er)

Married Filing

Separately

Head of Household

10%

$0

$8,350

$0

$16,700

$0

$8,350

$0

$11,950

15%

$8,351

$33,950

$16,701

$67,900

$8,351

$33,950

$11,951

$45,500

25%

$33,951

$82,250

$67,901

$137,050

$33,951

$68,525

$45,501

$117,450

28%

$82,251

$171,550

$137,051

$208,850

$68,525

$104,425

$117,451

$190,200

33%

$171,551

$372,950

$208,851

$372,950

$104,426

$186,475

$190,201

-

$372,950

35%

$372,951+

$372,951+

$186,476+

$372,951+

You are to

write a program to compute personal income tax. Your program should prompt the

user to enter the filing status and taxable income and compute the tax. Enter

0

for single filers,

1

for married filing jointly,

2

for married filing separately, and

3

for head

of household.

Here are sample runs of the program:

Sample 1:

Enter the filing status:

0

Enter the taxable income:

100000

Tax is 21720.0

Sample 2:

Enter the filing status:

1

Enter the taxable income:

300339

Tax is

76932

.87

Sample 3:

Enter the filing status:

2

Enter the taxable income:

123500

Tax is 29665.5

Sample 4:

Enter the filing status:

3

Enter the taxable income:

4545402

Tax is 1565250.7

Explanation / Answer

import java.text.NumberFormat;
import java.util.Scanner;

public class lab3 {

public static void main(String[] args) {
// TODO Auto-generated method stub
// Create a Scanner
Scanner input = new Scanner(System.in);

// Prompt the user to enter filing status
System.out.print(" 0-single filersn 1-married filing jointly or" +
"qualified widow(er)n 2-married filing seperatelyn 3-head of" +
"householdn Enter your filing status: ");

int status = input.nextInt();

if (!(status == 0 || status == 1 || status == 2 || status == 3)){
System.out.println((" Incorrect filing status! Please try again."));
System.exit(1);
}

// Prompt user to enter taxable income
System.out.print(" Enter your taxable income: ");
double income = input.nextDouble();

switch (status) {
case 0:
income = getTax(income, 9075, 36900, 89350, 186350, 405100, 406750);
break;
case 1:
income = getTax(income, 18150, 73800, 148850, 226850, 405100, 457600);
break;
case 2:
income = getTax(income, 9075, 36900, 74425, 113425, 202550, 228800);
break;
case 3:
income = getTax(income, 12950, 49400, 127550, 206600, 405100, 432200);
break;

}
}

public static double getTax(double income, double upperBracket10, double upperBracket15,
double upperBracket25, double upperBracket28, double upperBracket33, double upperBracket35) {
double tax = 0;


if (income <= upperBracket10)
tax = income * 0.10;
else if (income <= upperBracket15)
tax = upperBracket10 * 0.10 + (income - upperBracket10) * 0.15;
else if (income <= upperBracket25)
tax = upperBracket10 * 0.10 + (upperBracket15 - upperBracket10) * 0.15 +
(income - upperBracket15) * 0.25;
else if (income <= upperBracket28)
tax = upperBracket10 * 0.10 + (upperBracket15 - upperBracket10) * 0.15 +
(upperBracket25 - upperBracket15) * 0.25 + (income - upperBracket25) *0.28;
else if (income <= upperBracket33)
tax = upperBracket10 * 0.10 + (upperBracket15 - upperBracket10) * 0.15 +
(upperBracket25 - upperBracket15) * 0.25 + (186350 - upperBracket25) * 0.28 +
(income - upperBracket28) * .33;
else if (income <= upperBracket35)
tax = upperBracket10 * 0.10 + (upperBracket15 - upperBracket10) * 0.15 +
(upperBracket25 - upperBracket15) * 0.25 + (upperBracket28 - upperBracket25) * 0.28 +
(upperBracket33 - upperBracket28) * .33 + (income - upperBracket33) * 0.35;
else
tax = upperBracket10 * 0.10 + (upperBracket15 - upperBracket10) * 0.15 +
(upperBracket25 - upperBracket15) * 0.25 + (upperBracket28 - upperBracket25) * 0.28 +
(upperBracket33 - upperBracket28) * .33 + (upperBracket35 -upperBracket33) * 0.35 +
(income - upperBracket35) *0.396;

return tax;


}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote