I'm writing a interactive application in Java and one of my local variables isn't adding itself into the class variable which is screwing up my final output.
Here is the class variable public static double deduction;
Here is what I'm trying to store into it
System.out.println("Do you want medical insurance?");
String choice = kb.nextLine();
if (choice == "yes")
{
medIns = 32.50;
}
else
{
medIns = 0;
}
System.out.println("Do you want dental insurance?");
choice = kb.nextLine();
if (choice == "yes")
{
dentIns = 20.00;
}
else
{
dentIns = 0;
}
System.out.println("Do you want long-term disability insurance?");
choice = kb.nextLine();
if (choice == "yes")
{
lifeIns = 10.00;
}
else
{
lifeIns = 0;
}
deduction = medIns + dentIns + lifeIns;
return deduction;`
Here is what it's finally going into totalpay = gross + (gross * retire) - deduction;
When I put in all the other input it's not storing the local deduction into the class deduction so it can be processed into my totalpay calculation.