public static void main(String[] args)
{
CollegeTester ct = new CollegeTester();
ct.getCommand();//goes to command
}
//Ask user for a command
public void getCommand()
{
String command = "";
System.out.println("Enter a command: ");
command = input.nextLine();
if(command.equals("add"))
addCommand();//If command is add go to addCommand
if(command.equals("course"))
courseCommand();//If command is course go to courseCommand
if(command.equals("find"))
findCommand();
if(command.equals("remove"))
removeCommand();
if(command.equals("highest"))
highestCommand();
if(command.equals("login"))
loginCommand();
if(command.equals("quit"))
System.exit(1);
}
I want to repeat the getCommand() method until the user types in quit but it always fails
i tried to put getCommand() at the end of each other method & if statements it won't repeat
i tried to do a while loop for everything but if someone accidently types mistypes quit the program would never end
How would i effectively go back to this method until the user wishes to quit?