Hello, I'm just wondering if there is anything for something like string.notequal(anotherString). Basically, in my while loop, I want it to keep asking the size of the pizza they want if the input string doesn't equal any of the three final Strings. Thanks so much for any help in advance! (I know != and == do not work with Strings, that is just there to help point out my question. I also tried something along the lines of:
while(input.compareTo(SMALL) == 1
import javax.swing.JOptionPane; public class TestPizza { public static String input; public static String pSize; public static String stringSize; final static String LARGE = "Large"; final static String SMALL = "Small"; final static String MEDIUM = "Medium"; public static void main(String[] args) { input = JOptionPane.showInputDialog("Enter the size of pizza you want" + "(Small, Medium, or Large:"); Pizza pizzaSize = new Pizza(input); while(input != SMALL) { JOptionPane.showMessageDialog(null, "You've entered an invalid" + " size"); input = JOptionPane.showInputDialog("Enter width of room:"); } pizzaSize.display(input); } }
Thanks again for any help!