After a few tutorials I've finally started playing around with the GUI and I'm playing with taking user input and putting them into an equation. Right now my problem is trying give a Yes/No answer a value. At first I tried to make it a boolean but got utterly confused. So I turned it into a string and made an if statement that changes the value of a variable. The issue I am having right now is that whether or not I put yes or no for "Are you furthernig your education?" I will get the same output value.
package sandbox; import javax.swing.JOptionPane; class Play { public static void main(String[] args){ String money =JOptionPane.showInputDialog("How often do you get paid in a week?"); String edu =JOptionPane.showInputDialog("Are you furthering your education?"); String pt =JOptionPane.showInputDialog("How often do you workout in a week?"); int school; if (edu == "Yes"){ school = 5; } else {school = 0;} int paid = Integer.parseInt(money); int excercise = Integer.parseInt(pt); int score = paid+excercise*3*school/2; JOptionPane.showMessageDialog(null, "Your value is " + score, "Pass!", JOptionPane.PLAIN_MESSAGE); } }