java如何制作跳过开关的开关?
注意:它只是一个基本的java程序,没有jframe等
import java.io.*;
public class Case1 {
public static void main(String[] Ropher) throws IOException{
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
int t; int y;
System.out.print("Welcome To M.Y Hotel!");
System.out.println("\nPlease Select For Information");
System.out.println("1 --- Bed Menu");
System.out.println("2 --- Food Menu");
System.out.println("3 --- Exit");
System.out.println("");
t = Integer.parseInt(br.readLine());
switch (t){
case 1 :
System.out.println("1 --- Single Bed");
System.out.println("2 --- Double Bed");
System.out.println("3 --- Family Bed");
System.out.println("4 --- Social Bed");
break;
case 2:
System.out.println("1 --- Appetizer");
System.out.println("2 --- Soup");
System.out.println("3 --- Breakfast");
System.out.println("4 --- Lunch");
System.out.println("5 --- Dinner");
break;
}
System.out.println("Please Select");
y = Integer.parseInt(br.readLine());
switch (y){
case 1:
System.out.println("Single Beds: ");
System.out.println("Standard --- P750");
System.out.println("King Bed --- P1000");
System.out.println("Crystal Bed --- P1750");
System.out.println("Water Bed --- P2000");
case 2:
System.out.println("Double Beds: ");
System.out.println("Deluxe A --- P1000");
System.out.println("Deluxe B --- P1500");
System.out.println("Water Double Bed --- P3000");
}
}
}
我想制作一个程序,如果我在开关(t)中选择案例2,则会弹出一些内容(例如开胃菜)以获取该选择的信息,并在开关(y)中跳过案例
# 1 楼答案