I\'m looking to keep the following menu repeating:
Choose an Option
1 - FIND
2 - IN-SHUFFLE
3 - OUT-SHUFFLE
try this. You just have to move quit out of loop and bring in opions and userchoice into loop.
import java.util.Scanner;
public class Switchh {
static boolean quit = false;
public static void main(String[] args) {
int userChoice;
userChoice = menu();
}
private static int menu() {
Scanner scanner = new Scanner(System.in);
int choice;
do {
System.out.println("Choose an Option");
System.out.println("1 - FIND");
System.out.println("2 - IN-SHUFFLE");
System.out.println("3 - OUT-SHUFFLE");
choice = scanner.nextInt();
System.out.println("Choose an Option");
switch (choice) {
case 1:
System.out.println("\n1 - FIND\n");
//Deck.findTop();
break;
case 2:
System.out.println("\n2 - IN-SHUFFLE\n");
// call method
break;
case 3:
System.out.println("\n3 - OUT-SHUFFLE\n");
// call method
break;
default:
System.out.println("\nInvalid Option");
quit = true;
break;
}
}
while (!quit);
return choice;
}
}