if (choice.equals("1")){
int c = 0;
System.out.println("Welcome " + name + ",");
System.out.println("\nYou have chosen to play [1] " + arr[c][0] +".\n");
System.out.println(arr[c][0] +" costs €" + arr[c][2] + " to play and has a minimum purchase of " + arr[c][1] + " lines.") ;
System.out.print("\nHow many " + arr[c][0] + " would you like? ");
int num = s1.nextInt();
while (num < Integer.parseInt(arr[c][1])){
System.out.println( arr[c][0] + " has a minimum purchase of " + arr[c][1] + " lines");
num = s1.nextInt();
}
System.out.println("\nThe total cost to play "+ arr[c][0] + " will be €" + (num*Double.parseDouble(arr[c][2])));
System.out.println("\nContinue? Y/N/Q");
String cont = s1.next().toUpperCase();
if (cont.equals("N")||cont.equals("n")){
System.out.print("\nHow many " + arr[c][0] + " would you like? ");
}
else if (cont.equals("Q")||cont.equals("q")){
menu();
}
else if (cont.equals("Y")||cont.equals("y")) {
//call the random generator
random(c,num);
//call the menu
menu();
}
else {
System.out.println("Invalid option");
menu();
}
}
如果我选择“N”,它应该再次询问 System.out.print("\nHow many " + arr[c][0] + " 你想要吗?"); 并再次读取值,我该怎么做?