Updated Answer for Updated Question
For flow purposes, you should query first outside the loop, and then query again at the end of the loop in preparation for the next iteration. You had the order slightly off, so weird things would have happened, but most of the code was right.
// Get the first Customer ID
System.out.println("Enter Customer ID: ");
customerID = input.nextInt();
while(customerID != -1)
{
// Get income and withholding information
System.out.print("Enter Income: ");
income = input.nextDouble();
System.out.print("Enter Federal Taxes Withheld: ");
federalwh = input.nextDouble();
System.out.print("Enter State Taxes Withheld: ");
statewh = input.nextDouble();
System.out.print("Enter Deductions: ");
deduction = input.nextDouble();
//!IMPORTANT SET all values for bracket to zero here!
bracket10to20 = 0.0;
//you can fill in all the rest
//put all the calculations here from original answer
//Get next customer id
System.out.print("Enter Customer ID: ");
customerID = input.nextInt();
// if it's -1, we won't go through while again
}
Original Answer for Original Question
Here's the problem line:
if(taxableIncome > 20000 && taxableIncome <= 40000);
The semicolon breaks it. Remove that. However, I would suggest you change your approach to else ifs. You've nested a lot of if/elses together, when you can actually chain them like this:
taxableIncome = income - deduction;
if (taxableIncome <= 10000) {
federalTax = 0.0;
} else if (taxableIncome > 10000 && taxableIncome <= 20000) {
bracket10to20 = (taxableIncome - 10000);
} else if (taxableIncome > 20000 && taxableIncome <= 40000) {
bracket20to40 = taxableIncome - 20000;
bracket10to20 = 10000;
} else if (taxableIncome > 40000) {
bracket40plus = taxableIncome - 30000;
bracket10to20 = 10000;
bracket20to40 = 20000;
}
federalTax = (bracket10to20 * 0.15) + (bracket20to40 * 0.2)
+ (bracket40plus * 0.3);
This is significantly easier to read and you don't have to track all the nesting. As always, formatting reduces the chance of errors in code and makes it easier for others to help.