[Off-topic] Enraged21:
Assignment 1 was submitted. Now onto Assignment 2. I've got the code written, but it is not calculating properly. I've looked it over and it seems good to me.

Can someone tell me what I'm doing wrong?

Problem Description:

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 1 shows the rates for 2009.

Table 1

2009 U.S. Federal Personal Tax Rates

Marginal Tax Rate

10%

15%

25%

28%

33%

35%

Single

$0 - $8,350 (10%)

$8,351 - $33,950 (15%)

$33,951 - $82,250 (25%)

$82,251 - $171,550 (28%)

$171,551 - $372,950 (33%)

$372,951+ (35%)

Married Filing Jointly or Qualified Widow(er)

$0 - $16,700 (10%)

$16,701 - $67,900 (15%)

$67,901 - $137,050 (25%)

$137,051 - $208,850 (28%)

$208,851 - $372,950 (33%)

$372,951+ (35%)

Married Filing Seperately

Head of Household

//I've only done cases for single and married filing jointly. Married filing jointly is not calculating properly.

Case 1:

Enter the filing status: 0

Enter the taxable income: 100000

Tax is 21720.0

Case 2:

Enter the filing status: 1

Enter the taxable income: 300339

Tax is 78777.87

import java.io.*;

public class javaAssign2 {

public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter your filing status.");
System.out.println("0: Single");
System.out.println("1: Married filing jointly");
System.out.println("2: Married filing seperately");
System.out.println("3: Head of Household");
int status = Integer.parseInt(br.readLine());

System.out.print("Enter the taxable income: ");
double income = Integer.parseInt(br.readLine());
double tax = 0;

switch (status) {
case 0: {
if (income <= 8350)
tax = income * .10;
if (income > 8351 && income <= 33950)
tax = 8350 * 0.10 + (income - 8350) * 0.15;
if (income > 33950 && income <= 82250)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (income - 33950)
* 0.25;
if (income > 82250 && income <= 171550)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950)
* 0.25 + (income - 82250) * 0.28;
if (income > 171550 && income <= 372950)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950)
* 0.25 + (171550 - 82250) * 0.28 + (income - 171550)
* 0.33;
if (income > 372950)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950)
* 0.25 + (171550 - 82250) * 0.28 + (372950 - 171550)
* 0.33 + (income - 372950) * 0.35;
break;
}

//case 1 is not calculating to the same tax as the test case 1 is.
case 1: {
if (income <= 16700)
tax = income * 0.10;
if (income > 16700 && income <= 67900)
tax = 16700 * 0.10 + (income - 16700) * 0.15;
if (income > 67900 && income <= 137050)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 + (income - 67900)
* 0.25;
if (income > 137050 && income <= 208850)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 + (137050 - 67900)
* 0.25 + (income - 137050) * 0.28;
if (income > 208850 && income <= 372950)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 + (137050 - 67900)
* 0.25 + (208850 - 137050) * 0.28 + (income - 208850)
* 0.33;
if (income > 372950)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 + (137050 - 67900)
* 0.25 + (208850 - 137050) * 0.28 + (372950 - 208850)
* 0.33 + (income - 372950) * 0.35;
break;
}

}

System.out.println("Tax is " + tax);

}

}

plus there has to be a shorter way of doing all that math.

.