​
import java.util.Scanner;public class day08zy {public static void main(String[] args) {int size = 50;String[] orderNameArray = new String[size];//菜品名称String[] orderNumberArray = new String[size];//菜品数量String[] orderPriceArray = new String[size];//菜品价格String[] orderTimeArray = new String[size];//送餐时间String[] orderWayArray = new String[size];//送餐地址String[] orderDianzanArray = new String[size];//点赞数String[] orderPhoneArray = new String[size];//送餐电话String[] orderManArray = new String[size];orderNameArray[0] = "惠林顿牛排";orderNumberArray[0] = "2";orderPriceArray[0] = "500";orderTimeArray[0] = "2021年7月19日";orderWayArray[0] = "汤臣一品";orderDianzanArray[0] = "100";orderPhoneArray[0] = "15002711507";orderManArray[0] = "川哥";boolean isExit = false;while (!isExit) {Scanner sc = new Scanner(System.in);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.删除订单");String choice = sc.nextLine();switch (choice) {case "1":int tempIndex = -1;//循环遍历数组,查看应该存在的位置,第一次 null 值出现的位置for (int i = 0; i < orderNameArray.length; i++) {//如果为null,当前的下标位置就是 i 的值if (orderNameArray[i] == null) {tempIndex = i;//跳出for循环break;}}//判断一下if (tempIndex == -1) {System.out.println("订单已装满...");//跳出switch语句break;}//键盘录入数据啦System.out.println("请输入订单的菜品名称:");orderNameArray[tempIndex] = sc.nextLine();System.out.println("请输入订单的数量:");orderNumberArray[tempIndex] = sc.nextLine();System.out.println("请输入订单的价格:");orderPriceArray[tempIndex] = sc.nextLine();System.out.println("请输入订单的时间:");orderTimeArray[tempIndex] = sc.nextLine();System.out.println("请输入送餐的地址:");orderTimeArray[tempIndex] = sc.nextLine();System.out.println("请输入姓名:");orderManArray[tempIndex] = sc.nextLine();System.out.println("请输入电话:");orderPhoneArray[tempIndex] = sc.nextLine();System.out.println("下单成功!");break;case "2"://判断内容是否全部是 null 值,如果全部是 null 值,则表示没有商品,如果没有商品,后续的代码不再执行int count = 0;for (int i = 0; i < orderNameArray.length; i++) {if (orderNameArray[i] == null) {count++;}}//最后当 count == size 也就是20相等的话,表示全部是nullif (count == size) {System.out.println("当前没有添加订单,请先添加订单");break;}System.out.println("编号\t菜品名称\t菜品数量\t菜品价格\t订餐时间\t订餐人地址\t订餐人姓名\t订餐人联系电话");//定义总价格double sum = 0;for (int i = 0; i < orderNameArray.length; i++) {String name = orderNameArray[i];if (name == null) {continue;}String number = orderNumberArray[i];String price = orderPriceArray[i];String time = orderTimeArray[i];String Way = orderWayArray[i];String Man = orderManArray[i];String Phone = orderPhoneArray[i];String index = (i + 1) + "";Double s1 =Double.parseDouble(orderNumberArray[i]);Double s2 =Double.parseDouble(orderPriceArray[i]);sum += s1*s2;System.out.println(index + "\t\t" + name + "\t\t" + number + "\t\t" + price + "\t" + time + "\t" + Way + "\t" + Man + "\t\t" + Phone);}System.out.println("商品总价格:¥" + sum + "元");break;case "3":System.out.println("已完成");break;case "4":System.out.println("请输入要删除的订单号:");Scanner scanner = new Scanner(System.in);int b = scanner.nextInt();orderNameArray[b - 1] = null;orderNumberArray[b - 1] = null;orderPriceArray[b - 1] = null;orderTimeArray[b - 1] = null;orderWayArray[b - 1] = null;orderDianzanArray[b - 1] = null;orderPhoneArray[b - 1] = null;orderManArray[b - 1] = null;System.out.println("订单删除成功");break;case "5"://判断内容是否全部是 null 值,如果全部是 null 值,则表示没有商品,如果没有商品,后续的代码不再执行int count1 = 0;for (int i = 0; i < orderNameArray.length; i++) {if (orderNameArray[i] == null) {count1++;}}//最后当 count == size 也就是20相等的话,表示全部是nullif (count1 == size) {System.out.println("当前没有添加订单,请先添加订单");break;}System.out.println("请输入要点赞的菜品序号:");System.out.println("编号\t菜品名称\t菜品价格");Scanner sca = new Scanner(System.in);int d = sca.nextInt();int one = Integer.parseInt( orderDianzanArray[d-1]);orderDianzanArray[d-1]+=1;System.out.println("点赞成功");break;case "6":default:System.out.println("程序退出");isExit = true;break;}}}
}​

运行结果:

Java 在线订餐系统相关推荐

  1. java在线订餐系统(1)

    粗略的前端页面

  2. JAVA JSP 餐厅点餐系统源码(点餐系统)jsp点餐系统网上订餐系统在线订餐系统

    JAVA JSP javaweb餐厅点餐系统源码(点餐系统)jsp点餐系统网上订餐系统在线订餐系统

  3. Java项目:springboot在线订餐系统

    作者主页:源码空间站2022 简介:Java领域优质创作者.Java项目.学习资料.技术互助 文末获取源码 项目介绍 SpringBoot在线订餐系统项目.主要功能说明: 分为两个角色,餐厅老板和普通 ...

  4. SSM毕设项目基于web的在线订餐系统sbh8k(java+VUE+Mybatis+Maven+Mysql)

    SSM毕设项目基于web的在线订餐系统sbh8k(java+VUE+Mybatis+Maven+Mysql) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuil ...

  5. java基于springboot外卖在线订餐系统(厨艺论坛)有论文

    简介 本项目主要包括了外卖订餐系统(在线订餐和外卖配送).厨艺论坛系统.管理员后台.用户中心等功能.用户注册后可以选择餐桌在线点餐支付,也可以选择外卖配送到家的方式. 演示视频 https://www ...

  6. springboot在线订餐系统、

    下载地址:https://download.csdn.net/download/Gouzi99/23887654 项目介绍: springboot在线订餐系统. 系统说明: 项目引见 SpringBo ...

  7. 基于JAVA在线影视系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署

    基于JAVA在线影视系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署 基于JAVA在线影视系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署 本源码技术栈: 项目架构:B/S ...

  8. mysql网络订餐系统截屏_在线订餐系统mysql字段

    在线订餐系统mysql字段,随便写的了.也许要改变呢.再说吧啊. 在线订餐系统mysql字段 分成3个表开发 1.user 2.order 3.pay 1. 用户表包含下面字段 id int 主键,自 ...

  9. java 外卖订餐系统_java外卖订餐系统小项目

    本文实例为大家分享了java外卖订餐系统的具体代码,供大家参考,具体内容如下 执行结果: 通过选择功能序号,执行响应的功能: 代码实现: package 外卖订餐系统; /* * 代码优点,使用 循环 ...

最新文章

  1. Redis运维优化的陷阱及避坑指南
  2. 解决警告inconsistent dll linkage
  3. jQuery (DOM篇)
  4. Intent对象详解(一)
  5. iOS 本地化应用程序汇总 国际化
  6. tomcat 运行报错 JRE_HOME
  7. 微信企业号支付个人php实现
  8. 华硕 天选2 R9-5900HX RTX3060 安装ubuntu18.04以及探索内核与驱动的关系
  9. 中国十大电子商务网站排名
  10. orm之peewee
  11. 如何在eclipse制作的APP中添加背景图
  12. 如何建立一个网站?规划、设计、目的、原则、宣传(三)
  13. 大数据信息资料采集:刘润公众号历史商业评论文章采集评论搜集
  14. 2023年如何做谷歌SEO优化?谷歌优化排名怎么做?
  15. solr 从数据库导入数据,全量索引和增量索引(实例配置原理)
  16. 分类-动态渲染左侧的一级分类列表
  17. android 判断键盘是否弹起
  18. AT3576 E Popping Balls——计数思路
  19. 基于python的国内外研究现状_国内外研究现状评述
  20. buuctf_Misc-喵喵喵

热门文章

  1. 《OSChina每日一博》2018年05月整理合集
  2. mnist和fashion mnist区别
  3. 华为mate10用的android版本,Android P明日适配华为Mate10
  4. 科普:什么是处理器微架构?
  5. Spring Boot 集成Groovy
  6. 超强、超稳、超丰富。老司机看片,咱都懂!
  7. excel模板文件下载
  8. 【案例练习】12—50 个从今天就可以开始做起来的小型Web项目
  9. R语言table1包绘制表格转word的方法
  10. 大学选人工智能专业好不好?