I am having issues with determining the martial status of the input. I wrote it originally to only account for someone who is single. How can I change the tax rate based on whether or not the person is married?
import java.util.Scanner;
public class IncomeCalc {
public static void main (String[] args) {
Scanner fetch = new Scanner (System.in);
System.out.println("Enter Gross Annual Pay: ");
double grossPay = fetch.nextDouble();
System.out.println("Enter Your State Tax in Decimal Form: ");
float tax = fetch.nextFloat();
System.out.println("Are you Married (Y/N): ");
String status = fetch.next();
double fedTax = 0;
if (grossPay >= 518401 && status == "N") {
fedTax = (float) .37 * grossPay;
} else if (grossPay >= 612351 && status == "Y") {
fedTax = (float) .37 * grossPay;
} else if (grossPay >= 207351 && status == "N") {
fedTax = (float) .35 * grossPay;
} else if (grossPay >= 408201 && status == "Y") {
fedTax = (float) .35 * grossPay;
} else if (grossPay >= 163301 && status == "N") {
fedTax = (float) .32 * grossPay;
} else if (grossPay >= 321451 && status == "Y") {
fedTax = (float) .32 * grossPay;
} else if (grossPay >= 85526 && status == "N") {
fedTax = (float) .24 * grossPay;
} else if (grossPay >= 168401 && status == "Y") {
fedTax = (float) .24 * grossPay;
} else if (grossPay >= 40126 && status == "N") {
fedTax = (float) .22 * grossPay;
} else if (grossPay >= 78951 && status == "Y") {
fedTax = (float) .22 * grossPay;
} else if (grossPay >= 9875 && status == "N") {
fedTax = (float) .12 * grossPay;
} else if (grossPay >= 19401 && status == "Y") {
fedTax = (float) .12 * grossPay;
} else if (grossPay >= 0 && status == "N") {
fedTax = (float) .10 * grossPay;
} else if (grossPay >= 0 && status == "Y") {
fedTax = (float) .10 * grossPay;
} else {
System.out.println(":(");
}
float stateTaxes = (float) (grossPay * tax);
float netPay = (float) (grossPay - stateTaxes - fedTax);
System.out.print("Your monthly household income is: " + netPay);
}
}