System.out.println("序号" + "\t" + "菜名" + "\t\t" + "单价" + "\t" + "点赞数");
for (int j = 0; jdishNames.length; j++) {
System.out.println(
(j + 1) + "\t" + dishNames[j] + "\t\t" + prices[j] + "元" + "\t" + praiseNums[j]);
}
System.out.print("请选择您要点的菜品编号:");
int chooseDish = input.nextInt();
String dishMeg = dishNames[chooseDish - 1];
System.out.print("请选择您需要的份数:");
int number = input.nextInt();
System.out.print("请输入送餐时间(送餐时间是10点至20点间整点送餐):");
int time = input.nextInt();
while (time10 || time20) {
System.out.print("您的输入有误 , 请输入10-20间的整数");
time = input.nextInt();
}
System.out.print("请输入送餐地址:");
String address = input.next();
// 默认可以预定 , 不用写订单状态
System.out.println("订餐成功点餐系统java代码基?。?);
System.out.println("您定的是:" + dishNames[chooseDish - 1] + number + "份");
System.out.println("送餐时间:" + time + "点");
double sumPrice = prices[chooseDish - 1] * number;// 计算餐费
double sendMoney = (sumPrice = 50) ? 0 : 5;// 计算送餐费
System.out.println("餐费:" + sumPrice + "元," + "送餐费" + sendMoney + "元," + "总计:"
+ (sumPrice + sendMoney) + "元 。");
// 添加数据
names[i] = name;
dishMegs[i] = dishMeg;
times[i] = time;
dishNums[i] = number;
addresses[i] = address;
sumPrices[i] = sumPrice + sendMoney;
break;
}
if (isAdd) {
System.out.println("对不起,您的餐袋已满!");
}
}
break;
case 2:// 查看餐袋
System.out.println("***查看餐袋***");
System.out.println("序号\t订餐人\t餐品名称\t餐品数量\t送餐时间\t送餐地址\t总金额\t订单状态");
for (int i = 0; inames.length; i++) {
if (names[i] != null) {
String state = (states[i] == 0) ? "已预订" : "已完成";
System.out.println((i + 1) + "\t" + names[i] + "\t" + dishMegs[i] + "\t" + dishNums[i] + "份"
+ "\t" + times[i] + "\t" + addresses[i] + "\t" + sumPrices[i] + "元" + "\t" + state);
}
}
break;
case 3:// 签收订单
System.out.println("***签收订单***");
boolean isSignFind = false;
System.out.print("请选择要签收的订单序号:");
int sign = input.nextInt();
for (int i = 0; inames.length; i++) {
if (names[i] != nullstates[i] == 0sign == i + 1) {
states[i] = 1;
System.out.println("订单签收成功!");
isSignFind = true;// 标记已找到的订单
} else if (names[i] != nullstates[i] == 1sign == i + 1) {
System.out.println("您选择的订单已完成签收 , 不能再次签收!");
isSignFind = true;// 标记已找到的订单
}
}
if (!isSignFind) {
System.out.println("您选择的订单不存在!");
}
break;
case 4:// 删除订单
System.out.println("***删除订单***");
boolean isDelFind = false;
System.out.print("请输入要删除的订单序号:");
int delID = input.nextInt();
for (int i = 0; inames.length; i++) {
【点餐系统java代码基础 java点餐系统源码】// 根据状态值判断能不能删除 , 只有已完成的才能删除
if (names[i] != nullstates[i] == 1delID == i + 1) {
isDelFind = true;
for (int j = delID - 1; jnames.length - 1; j++) {
names[j] = names[j + 1];
dishMegs[j] = dishMegs[j + 1];
dishNums[j] = dishNums[j + 1];
times[j] = times[j + 1];
addresses[j] = addresses[j + 1];
states[j] = states[j + 1];
sumPrices[j] = sumPrices[j + 1];
}
// 将最后一位清空
names[names.length - 1] = null;
推荐阅读
- 3050显卡原神怎么设置,原神3060显卡
- mysql是一个常用的数据库,mysql数据库是一种什么结构的软件
- 企业怎么发视频号,企业怎么发视频号赚钱
- 泸州软件游戏开发团队招聘,泸州游戏公司招聘
- java多文件上传代码 java实现文件上传的三种方式
- sap财务模块26讲视频,sap财务操作
- 足球经理固态硬盘怎么样,足球经理吃内存吗
- 网红帝师直播平台怎么样,网红帝师破产了
- mysql日期怎么倒序 mysql日期怎么写