Whenever I try to to an else statement, Eclipse highlights the line and says that the "else" is a syntax error and to delete it. My code looks like this
import java.util.Scanner;
public class P4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
double grossSalary, interestIncome, capitalGains, totalIncome, adjustedIncome, totalTax, stateTax;
int exemptions;
Scanner input = new Scanner(System.in);
System.out.print("Gross Salary: ");
grossSalary = input.nextDouble();
System.out.print("Number of Exemptions: ");
exemptions = input.nextInt();
System.out.print("Interest Income: ");
interestIncome = input.nextDouble();
System.out.print("Capital Gains: ");
capitalGains = input.nextDouble();
totalIncome = grossSalary + interestIncome + capitalGains;
adjustedIncome = totalIncome - (exemptions * 1800.0);
if ((adjustedIncome >= 0.0 && adjustedIncome < 10000.0));
stateTax = adjustedIncome * .06;
totalTax = 0.0 + stateTax;
else if (adjustedIncome >= 10000.0 && adjustedIncome < 25000.0);
stateTax = adjustedIncome * .06;
totalTax = (adjustedIncome * .15) + stateTax;
else if (adjustedIncome >= 25000.0 && adjustedIncome < 36000);
stateTax = adjustedIncome * .06;
totalTax = (adjustedIncome * .25) + stateTax;
else (adjustedIncome >= 36000.0);
stateTax = adjustedIncome * .06;
totalTax = (adjustedIncome * .28) + stateTax;
System.out.printf("Total Income: $ %.2f", totalIncome);
System.out.println();
System.out.printf("Adjusted Income: $ %.2f", adjustedIncome);
System.out.println();
System.out.printf("Total Tax: $ %.2f", totalTax);
System.out.println();
System.out.printf("State Tax: $ %.2f", stateTax);
}
}
The else if statements are coming back as errors as well. I don't understand what's wrong with the statements, because even when I try to put an else directly after the if, it still says that theres a syntax error.