I'm trying to put a do...while loop into this code
import javax.swing.JOptionPane; public class UpperLowerCase2 { public static void main(String[] args) { int choice; String someString,menu; menu = "Enter\n" + "(1) Enter a string\n" + "(2) Convert the string to all uppercase\n" + "(3) Convert the String to all lowercase\n" + "(4) Quit"; do{ someString = JOptionPane.showInputDialog( menu ); choice = Integer.parseInt( someString ); switch (choice) { case 1: enterAString(); case 2: stringToUppercase(); case 3: convertStringLower(); case 4: System.out.println("Quit"); } }while(choice!=4); } public static void enterAString() { String outputmessage,string; string = JOptionPane.showInputDialog("Enter Your String"); outputmessage = "You entered " + string; JOptionPane.showMessageDialog( null, outputmessage ); System.exit(0); } public static void stringToUppercase() { String outputMessage2,string2; string2 = JOptionPane.showInputDialog("Enter String to convert to UPPERCASE"); string2 = string2.toUpperCase(); outputMessage2 = " Here Ya Go " + string2; JOptionPane.showMessageDialog(null, outputMessage2); System.exit(0); } public static void convertStringLower() { String outputMessage3,string3; string3 = JOptionPane.showInputDialog("Enter String to convert to lowercase"); string3 = string3.toLowerCase(); outputMessage3 = "Here Ya Go " + string3; JOptionPane.showMessageDialog(null, outputMessage3); System.exit(0); } }
However it isn't looping can somebody fix it for me or tell me what i need to do. The program runs, but it dosen't loop. Help Pleez