So i have a do while loop and i have user input coming in to detect which character the user entered...i want it to loop until the user enters a valid character...q or Q quits the program, whereas r,R,c,C are all valid characters. If a different character, for example 'L' were entered, it should loop back until a proper character is entered...I'm a beginner and i simply don't know the commands or logic behind this to be able to do this and any help would be greatly appreciated.
Here is what I have:
do { input = JOptionPane.showInputDialog("Please enter shape of pizza, R or C (Q to quit)"); if(input == null || input.toUpperCase().equals("Q")) { return; } } while (input.toUpperCase().equals("C") || !input.toUpperCase().equals("R")); shape = input;