最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Java實(shí)現(xiàn)簡(jiǎn)單點(diǎn)餐系統(tǒng)

 更新時(shí)間:2022年01月25日 15:48:29   作者:STAR?Wang  
這篇文章主要為大家詳細(xì)介紹了Java實(shí)現(xiàn)簡(jiǎn)單點(diǎn)餐系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

用Java實(shí)現(xiàn)簡(jiǎn)單點(diǎn)餐系統(tǒng),供大家參考,具體內(nèi)容如下

程序控制分析:

1、歡迎頁(yè)循環(huán):do-while
2、Scanner 控制輸入
3、選擇頁(yè)循環(huán):switch-case

要求:

訂單信息:String 二維數(shù)組
序號(hào)、姓名、餐品名稱、份數(shù)、價(jià)格、總價(jià)、地址、時(shí)間(10-20)、狀態(tài)(已預(yù)定、已完成)、熱度(int型)

簽收訂單:改變訂單狀態(tài),已預(yù)定可以簽收,如果已經(jīng)完成則不能再次簽收。

刪除訂單:不能刪除未完成訂單,序號(hào)要隨之改變。

我要點(diǎn)贊:對(duì)相應(yīng)的餐品點(diǎn)贊,并展示。

package Practice;

import java.util.Scanner;

public class Obj {
? ? public static void main(String[] args) {
? ? ? ? Scanner sc=new Scanner(System.in);
? ? ? ? String dishes[]={"紅燒肉","燒熊掌","清蒸魚","白斬雞","烤乳鴿"};
? ? ? ? int price[]={58,88,45,56,44};
? ? ? ? int honors[]={50,100,20,12,44};
? ? ? ? int hot[]={5,4,3,2,0};
? ? ? ? String orders[][]=new String[1024][];

? ? ? ? int chose=0;
? ? ? ? System.out. println("歡迎關(guān)嶺紅浪漫餐廳");
? ? ? ? do {
? ? ? ? ? ? System.out.println("*****************"); ? ?//顯示菜單
? ? ? ? ? ? System.out.println("1、我要訂餐");
? ? ? ? ? ? System.out.println("2、查看餐袋");
? ? ? ? ? ? System.out.println("3、簽收訂單");
? ? ? ? ? ? System.out.println("4、刪除訂單");
? ? ? ? ? ? System.out.println("5、我要點(diǎn)贊");
? ? ? ? ? ? System.out.println("6、退出系統(tǒng)");
? ? ? ? ? ? System.out.println("*****************");
? ? ? ? ? ? System.out.println("請(qǐng)選擇:");
? ? ? ? ? ? chose=sc.nextInt();
//訂餐流程-------------------------------------------------------------------------------------
? ? ? ? ? ? switch (chose) {

? ? ? ? ? ? ? ? case 1:
? ? ? ? ? ? ? ? ? ? System.out.println("***我要訂餐***");
? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入訂餐人姓名:");
? ? ? ? ? ? ? ? ? ? String name=sc.next();

? ? ? ? ? ? ? ? ? ? System.out.println("序號(hào) ? ? 菜品 ? ?單價(jià) ? 熱度");
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < dishes.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println(i+1+"\t\t"+dishes[i]+"\t"+price[i]+"元\t"+"\t"+hot[i]);
? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? int dishNum=0;
? ? ? ? ? ? ? ? ? ? do{
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("菜品編號(hào)");
? ? ? ? ? ? ? ? ? ? ? ? dishNum=sc.nextInt();
? ? ? ? ? ? ? ? ? ? ? ? if ((dishNum<1||dishNum>dishes.length)){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("對(duì)不起,輸入有誤,請(qǐng)重新輸入!");
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }while (dishNum<1||dishNum>dishes.length);

? ? ? ? ? ? ? ? ? ? int pcs=0;
? ? ? ? ? ? ? ? ? ? do {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("份數(shù)");
? ? ? ? ? ? ? ? ? ? ? ? pcs=sc.nextInt();
? ? ? ? ? ? ? ? ? ? ? ? if (pcs<1){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("對(duì)不起,輸入有誤,請(qǐng)重新輸入!");
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }while (pcs<1);


? ? ? ? ? ? ? ? ? ? int time;
? ? ? ? ? ? ? ? ? ? do {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("送餐時(shí)間");
? ? ? ? ? ? ? ? ? ? ? ? time=sc.nextInt();
? ? ? ? ? ? ? ? ? ? ? ? if (time<10||time>22){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("對(duì)不起,輸入有誤,請(qǐng)重新輸入!");
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }while (time<10||time>22);

? ? ? ? ? ? ? ? ? ? System.out.println("地址");
? ? ? ? ? ? ? ? ? ? String addres=sc.next();

? ? ? ? ? ? ? ? ? ? System.out.println("success!");
? ? ? ? ? ? ? ? ? ? System.out.println(
? ? ? ? ? ? ? ? ? ? ? ? ? ? "您定的商品信息是:" +dishes[dishNum]+ "\t" +dishNum+"份");
? ? ? ? ? ? ? ? ? ? System.out.println("送餐時(shí)間為"+time);

? ? ? ? ? ? ? ? ? ? double cost=price[dishNum-1]*pcs;
? ? ? ? ? ? ? ? ? ? double sent=cost>50?0:6;
? ? ? ? ? ? ? ? ? ? double total=cost+sent;
? ? ? ? ? ? ? ? ? ? System.out.println("餐費(fèi)共計(jì)"+total+" 其中快遞費(fèi)"+sent+"元");

? ? ? ? ? ? ? ? ? ? for (int i = 0; i < orders.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]==null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? orders[i]=new String[3];
? ? ? ? ? ? ? ? ? ? ? ? ? ? orders[i][0]=name+"\t"+dishes[dishNum-1]+"\t"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +pcs+"份\t"+time+"\t"+addres+"\t"+cost+"元"; ?//orders第一存儲(chǔ) 菜品信息
? ? ? ? ? ? ? ? ? ? ? ? ? ? orders[i][1]="已預(yù)定"; ? ? ? ? ? ? ? ? ? ? ?//orders第二存儲(chǔ) 訂單信息
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? break;
//查看餐袋------------------------------------------------------------------------------
? ? ? ? ? ? ? ? case 2:
? ? ? ? ? ? ? ? ? ? System.out.println("***查看餐袋***");
? ? ? ? ? ? ? ? ? ? System.out.println("序號(hào)\t訂餐人 ?餐品信息 時(shí)間 地址 總金額 ? ?訂單狀態(tài)");
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < orders.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]!=null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println(i+1+"\t"+orders[i][0]+"\t\t"+orders[i][1]);
? ? ? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? break;
//訂單簽收----------------------------------------------------------------------------
? ? ? ? ? ? ? ? case 3:
? ? ? ? ? ? ? ? ? ? System.out.println("***簽收訂單***");
? ? ? ? ? ? ? ? ? ? int num;
? ? ? ? ? ? ? ? ? ? int end=0;
? ? ? ? ? ? ? ? ? ? System.out.println("序號(hào)\t訂餐人 ?餐品信息 時(shí)間 地址 總金額 ? ?訂單狀態(tài)");
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < orders.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]!=null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println(i+1+"\t"+orders[i][0]+"\t\t"+orders[i][1]);
? ? ? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? do {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入要簽收訂單序號(hào):");
? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < orders.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]==null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end=i+1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? num=sc.nextInt();

? ? ? ? ? ? ? ? ? ? ? ? if (num<0||num>end){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("輸入有誤");
? ? ? ? ? ? ? ? ? ? ? ? }else if ("已預(yù)定".equals(orders[num-1][1])){
? ? ? ? ? ? ? ? ? ? ? ? ? ? orders[num-1][1]="已完成";
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("訂單已完成");
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("訂單已簽收,不能重復(fù)簽收");
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }while (num<1||num>end||"已預(yù)定".equals(orders[num-1][1]));

? ? ? ? ? ? ? ? ? ? break;
//刪除訂單------------------------------------------------------------------------
? ? ? ? ? ? ? ? case 4:
? ? ? ? ? ? ? ? ? ? System.out.println("***刪除訂單***");
? ? ? ? ? ? ? ? ? ? int n=0; ? //輸入數(shù)字
? ? ? ? ? ? ? ? ? ? int e=0; ?// 訂單的最大數(shù)量
? ? ? ? ? ? ? ? ? ? System.out.println("序號(hào)\t訂餐人 \t餐品信息 \t送餐時(shí)間 \t地址 \t總金額 \t狀態(tài)");
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < orders.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]!=null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.print(i+1+"\t"+orders[i][0]+"\t"+orders[i][1]+"\t");
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("\t ?"+orders[i][1]);
? ? ? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }


? ? ? ? ? ? ? ? ? ? do {
? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < orders.length; i++) { ? ? ? ?//確定訂單的最大數(shù)量
? ? ? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]==null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? e=i;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? System.out.println("要?jiǎng)h除的訂單編號(hào):");
? ? ? ? ? ? ? ? ? ? ? ? n=sc.nextInt();
? ? ? ? ? ? ? ? ? ? if (n<1||n>e){
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("err");
? ? ? ? ? ? ? ? ? ? }else if ( ! "已完成".equals(orders[n-1][1])){
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("訂單未完成,不能刪除");
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? boolean isDelete=false;
? ? ? ? ? ? ? ? ? ? ? ? for (int i = n-1; i < orders.length; i++) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? if (i==orders.length-1){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? orders[i]=null;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? isDelete=true; ? ? ? ? ?//
? ? ? ? ? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? orders[i]=orders[i+1]; ? //前移
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (orders[i]==null){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? isDelete=true;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }while (n<1||n>e||"已完成".equals(orders[n][1]));

? ? ? ? ? ? ? ? ? ? break;
//我要點(diǎn)贊----------------------------------------------------------------------------
? ? ? ? ? ? ? ? case 5:
? ? ? ? ? ? ? ? ? ? System.out.println("***我要點(diǎn)贊***");
? ? ? ? ? ? ? ? ? ? int hp=0;

? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)選擇點(diǎn)贊菜品:");
? ? ? ? ? ? ? ? ? ? hp=sc.nextInt();
? ? ? ? ? ? ? ? ? ? if (hp<1||hp>dishes.length){
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("對(duì)不起,輸入有誤,請(qǐng)重新輸入!");
? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? hot[hp-1]++;
? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? break;
//退出系統(tǒng)------------------------------------------------------------------------------------
? ? ? ? ? ? ? ? default:
? ? ? ? ? ? ? ? ? ? System.out.println("6、退出系統(tǒng)");

? ? ? ? ? ? }
//switch結(jié)束--------------------------------------------------------------------------------------
? ? ? ? ? ? if (chose>0&&chose<6){
? ? ? ? ? ? ? ? System.out.println("輸入0返回!");
? ? ? ? ? ? ? ? chose=sc.nextInt();
? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
//-----------------------------------------------------------------------------
? ? ? ? }while (chose==0);
? ? ? ? System.out.println("輸入0返回!");
? ? }

}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • MyBatis-Plus框架整合詳細(xì)方法

    MyBatis-Plus框架整合詳細(xì)方法

    MyBatis-Plus是一個(gè) MyBatis 的增強(qiáng)工具,在 MyBatis 的基礎(chǔ)上只做增強(qiáng)不做改變,為簡(jiǎn)化開(kāi)發(fā)、提高效率而生這篇文章主要介紹了MyBatis-Plus框架整合,需要的朋友可以參考下
    2022-04-04
  • springboot2.2 集成 activity6實(shí)現(xiàn)請(qǐng)假流程(示例詳解)

    springboot2.2 集成 activity6實(shí)現(xiàn)請(qǐng)假流程(示例詳解)

    這篇文章主要介紹了springboot2.2 集成 activity6實(shí)現(xiàn)請(qǐng)假完整流程示例詳解,本文通過(guò)示例代碼圖文相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-07-07
  • Java線程Timer定時(shí)器用法詳細(xì)總結(jié)

    Java線程Timer定時(shí)器用法詳細(xì)總結(jié)

    在本篇文章里小編給大家整理的是關(guān)于Java線程Timer定時(shí)器用法詳細(xì)總結(jié)內(nèi)容,需要的朋友們學(xué)習(xí)下吧。
    2020-02-02
  • spring security CSRF防護(hù)的示例代碼

    spring security CSRF防護(hù)的示例代碼

    這篇文章主要介紹了spring security CSRF防護(hù)的示例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2019-03-03
  • java  Super 用法詳解及實(shí)例代碼

    java Super 用法詳解及實(shí)例代碼

    這篇文章主要介紹了java Super 用法詳解及實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下
    2017-03-03
  • java 實(shí)現(xiàn)數(shù)組擴(kuò)容與縮容案例

    java 實(shí)現(xiàn)數(shù)組擴(kuò)容與縮容案例

    這篇文章主要介紹了java 實(shí)現(xiàn)數(shù)組擴(kuò)容與縮容案例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-02-02
  • Mybatis velocity腳本的使用教程詳解(推薦)

    Mybatis velocity腳本的使用教程詳解(推薦)

    很多朋友不清楚在mybatis可以使用各種腳本語(yǔ)言來(lái)定義Mapper文件里面的動(dòng)態(tài)SQL;目前mybatis支持的腳本語(yǔ)言有XML(默認(rèn)的);Velocity和Freemarker三種。下面通過(guò)本文給大家介紹Mybatis velocity腳本的使用,一起看看吧
    2016-11-11
  • SpringBoot接入支付寶支付的方法步驟

    SpringBoot接入支付寶支付的方法步驟

    這篇文章主要介紹了SpringBoot接入支付寶支付的方法步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12
  • java 使用Graphics2D在圖片上寫字

    java 使用Graphics2D在圖片上寫字

    這篇文章主要介紹了java 使用Graphics2D在圖片上寫字,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-11-11
  • IntelliJ IDEA中ajax開(kāi)發(fā)實(shí)現(xiàn)分頁(yè)查詢示例

    IntelliJ IDEA中ajax開(kāi)發(fā)實(shí)現(xiàn)分頁(yè)查詢示例

    這篇文章主要介紹了IntelliJ IDEA中ajax開(kāi)發(fā)實(shí)現(xiàn)分頁(yè)查詢,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-03-03

最新評(píng)論

乌拉特前旗| 京山县| 高碑店市| 泰州市| 万荣县| 永顺县| 施秉县| 三门县| 云南省| 武威市| 太康县| 锦州市| 宁波市| 丰县| 四会市| 安顺市| 安西县| 修武县| 社旗县| 嵊泗县| 沽源县| 秦安县| 隆回县| 晋江市| 淮安市| 康马县| 遂平县| 陈巴尔虎旗| 康定县| 高邑县| 陆河县| 北票市| 阳江市| 方山县| 红安县| 全椒县| 江孜县| 保定市| 上犹县| 岑巩县| 苗栗市|