由于我的舍友每天犹豫吃什么,所以我写了一个晚饭随机系统,哈哈哈哈哈哈哈哈哈
希望对选择困难症的治疗有所帮助/笑
import java.util.Random;
import java.util.Scanner;
public class supper {
public static void main(String[] args) {
while(true) {
System.out.println("----------晚饭随机系统----------");
System.out.println("1.简单对付一口(3-8元)");
System.out.println("2.追求饱腹感(8-12元)");
System.out.println("3.小食(10-15元)");
System.out.println("4.享受一把(20元即以上)");
System.out.println("5.饮品(2-5元)");
System.out.println("6.饮品(6-15元)");
System.out.println("7.退出系统");
System.out.println("请输入您预期的晚餐价位序号:");
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
String food = null;
if (num == 1) {
getString1();
} else if (num == 2) {
getString2();
} else if (num == 3) {
getString3();
} else if (num == 4) {
getString4();
} else if (num == 5) {
getString5();
} else if (num == 6) {
getString6();
} else if (num == 7) {
System.out.println("感谢您的使用!");
System.exit(0);
}
}
}
private static void getString6() {
Random r=new Random();
int num=r.nextInt(5)+1;
String food=null;
switch(num){
case 1:
food="古茗奶茶";
break;
case 2:
food="霸王茶姬";
break;
case 3:
food="茶百道";
break;
case 4:
food="蜜雪冰城";
break;
case 5:
food="酒";
break;
}
System.out.println("今天晚上喝"+food);
}
private static void getString5() {
Random r=new Random();
int num=r.nextInt(3)+1;
String food=null;
switch(num){
case 1:
food="水";
break;
case 2:
food="豆浆";
break;
case 3:
food="冰激凌";
break;
}
System.out.println("今天晚上喝"+food);
}
private static void getString4() {
Random r=new Random();
int num=r.nextInt(4)+1;
String food=null;
switch(num){
case 1:
food="烤鸭";
break;
case 2:
food="小火锅";
break;
case 3:
food="出去吃";
break;
case 4:
food="烧烤";
}
System.out.println("今天晚上吃"+food);
}
private static void getString3() {
Random r=new Random();
int num=r.nextInt(8)+1;
String food=null;
switch(num){
case 1:
food="炸鸡";
break;
case 2:
food="螺蛳粉";
break;
case 3:
food="烤冷面";
break;
case 4:
food="串串香";
break;
case 5:
food="脆皮烤鸡";
break;
case 6:
food="臭豆腐";
break;
case 7:
food="钵钵鸡";
break;
case 8:
food="肉夹馍";
break;
}
System.out.println("今天晚上吃"+food);
}
private static void getString2() {
Random r=new Random();
int num=r.nextInt(14)+1;
String food=null;
switch(num){
case 1:
food="凉面";
break;
case 2:
food="炒面";
break;
case 3:
food="炒米";
break;
case 4:
food="炒拉条";
break;
case 5:
food="米粉";
break;
case 6:
food="米线";
break;
case 7:
food="炒饼丝";
break;
case 8:
food="米饭套餐";
break;
case 9:
food="汉堡+可乐(maybe 会超过一点预消费)";
break;
case 10:
food="凉皮";
break;
case 11:
food="煎饼果子/鸡蛋灌饼";
break;
case 12:
food="土豆粉";
break;
case 13:
food="烩面";
break;
case 14:
food="羊肉泡馍";
break;
}
System.out.println("今天晚上吃"+food);
}
public static void getString1() {
Random r=new Random();
int num=r.nextInt(7)+1;
String food=null;
switch (num){
case 1:
food="包子";
break;
case 2:
food="粥";
break;
case 3:
food="酱香饼";
break;
case 4:
food="玉米";
break;
case 5:
food="饭团";
break;
case 6:
food="零食";
break;
case 7:
food="泡面";
break;
}
System.out.println("今天晚上吃"+food);
}
}