like[k] = n;
menu[k] = n1;
price[k] = n2;
}
}
}
for (int j = 0; j < 3; j++) {
System.out.println((j+1)+“\t”+menu[j]+" "+price[j]);
}
System.out.println(“请 《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》无偿开源 威信搜索公众号【编程进阶路】 选择您要点的菜品编号:”);
int x2 = num.nextInt();
for (int i = 0; i < 100; i++) {
if(caipin[i] == null){
caipin[i] = menu[x2-1];
break;
}
}
System.out.println(“请选择您需要的份数:”);
int x3 = num.nextInt();
for (int i = 0; i < 100; i++) {
if(sum[i] == 0){
sum[i] = x3;
break;
}
}
System.out.println(“请输入送餐时间:”);
String x4 = num.next();
for (int i = 0; i < 100; i++) {
if(times[i] == null){
times[i] = x4;
break;
}
}
System.out.println(“请输入送餐地址:”);
String x5 = num.next();
for (int i = 0; i < 100; i++) {
if(site[i] == null){
site[i] = x5;
break;
}
}
for (int i = 0; i < 100; i++) {
if(money[i] == 0){
money[i] = price[x2-1]*sum[i];
System.out.println(“订餐成功!”);
System.out.println(“您订的是:”+caipin[i]+" "+sum[i]+“份”);
System.out.println(“送餐时间:”+times[i]);
System.out.println(“餐费:”+money[i]+“元”+“送餐费:0元”+“总计”+money[i]+“元”);
// count = i;
// System.out.println(count);
break;
}
}
break;
case 2:
System.out.println(“查看餐袋”);
System.out.println(“序号\t”+“订餐人\t”+“餐品信息\t”+“送餐日期\t”+“送餐地址\t”+“总金额\t”+“订单状态\t”);
for (int i = 0; i < 100; i++) {
if(name[i] == null){
count = i;
break;
}
}
for (int i = 0; i < count; i++) {
System.out.println((i+1)+" “+name[i]+” “+caipin[i]+sum[i]+“份”+” “+times[i]+” "+
site[i]+" “+money[i]+” "+(stste[i]==0?“已预订”:“已完成”));
}
break;
case 3:
System.out.println(“签收订单”);
System.out.println(“请选择需要签收的订单序号:”);
int x6 = num.nextInt();
stste[x6-1] = 1;
System.out.println(“订单签收成功!”);
break;
case 4:
System.out.println(“删除订单”);
System.out.println(“请输入需要删除的订单序号:”);
int x7 = num.nextInt();
if(stste[x7-1] == 0){
System.out.println(“您选择的订单未签收,不能删除!”);
}else{
for (int i = x7-1; i < name.length; i++) {
if(name[i] == null){
break;
}else{
name[i] = name[i+1];
caipin[i] = caipin[i+1];
sum[i] = sum[i+1];
times[i] = times[i+1];
site[i] = site[i+1];
money[i] = money[i+1];
stste[i] = stste[i+1];
}
}
System.out.println(“您选择的订单已成功删除!”);
}
break;
case 5:
System.out.println(“我要点赞”);
System.out.println(“请输入您要点赞的菜品序号:”);
int y = num.nextInt();
like[y-1]++;
break;
default:
System.out.println(“祝您用餐愉快,欢迎下次光临!”);
break;
}
if(m == 6){
break;
}else{
System.out.println(“输入0返回:”);
int n = num.nextInt();
}
}while(true);
}
}
(集合)顾客点餐系统
==========
import java.util.*;
public class XiangMu2 {
public static void main(String[] args) {
List name = new ArrayList<>();
List caipin = new ArrayList<>();
List sum = new ArrayList<>();
List times = new ArrayList<>();
List site = new ArrayList<>();
List money = new ArrayList<>();
LinkedList stste = new LinkedList<>();
Map<Integer, String> menu = new HashMap<>();
// LinkedList menu = new LinkedList<>();
menu.put(0,“清蒸魚”);
menu.put(1,“爆炒大虾”);
menu.put(2,“麻婆豆腐”);
Map<Integer, Double> price = new HashMap<>();
// LinkedList price = new LinkedList<>();
price.put(0,58.9);
price.put(1,38.9);
price.put(2,18.9);
Map<Integer, Integer> like = new HashMap<>();
System.out.println(“欢迎使用快跑订餐系统”);
do{
System.out.println(“****************************”);
System.out.println(“1、我要订餐”);
System.out.println(“2、查看餐袋”);
System.out.println(“3、签收订单”);
System.out.println(“4、删除订单”);
System.out.println(“5、我要点赞”);
System.out.println(“6、退出系统”);
System.out.println(“****************************”);
System.out.println(“请选择:”);
Scanner num = new Scanner(System.in);
int m = num.nextInt();
int count = 0;
switch(m){
case 1:
System.out.println(“我要订餐”);
System.out.println(“请输入订餐人姓名:”);
name.add(num.next());
System.out.println(“序号\t”+“菜名\t”+“单价\t”);
for (int j = 0; j < 3; j++) {
System.out.println((j+1)+“\t”+menu.get(j)+" "+price.get(j));
}
System.out.println(“请选择您要点的菜品编号:”);
int x2 = num.nextInt()-1;
caipin.add(menu.get(x2));
System.out.println(“请选择您需要的份数:”);
int x3 = num.nextInt();
sum.add(x3);
System.out.println(“请输入送餐时间:”);
String x4 = num.next();
times.add(x4);
System.out.println(“请输入送餐地址:”);
String x5 = num.next();
site.add(x5);
money.add((price.get(x2) * x3));