欧美午夜精品久久久久免费视/欧美黄色精品/国产一级A片在线播出/A片免费视频在线观看

文中示例代碼:實現(xiàn)功能外賣訂餐系統(tǒng)運行效果圖
2024-01-16 22:00:38 歡樂點

java實現(xiàn)簡易外賣訂餐系統(tǒng)

更新時間:2021年10月04日10:25:07作者:Вадим

這篇文章主要為你們詳盡介紹了java實現(xiàn)簡易外賣訂餐系統(tǒng),文中示例代碼介紹的十分詳盡外賣訂餐系統(tǒng),具有一定的參考價值,感興趣的男子伴們可以參考一下

用java實現(xiàn)簡易外賣訂餐系統(tǒng),供你們參考,具體內(nèi)容如下

一、使用技術(shù)

二、實現(xiàn)功能

外賣訂餐系統(tǒng)

具體要求如下:

使用選擇結(jié)構(gòu),循環(huán)結(jié)構(gòu)外賣訂餐系統(tǒng),鏈表的知識實現(xiàn)一個外賣訂餐系統(tǒng)

三、運行療效圖

1.訂餐功能

2.查看餐袋

3.簽收訂單

4.刪掉訂單

5.點贊

6.退出

代碼實現(xiàn)

public class Order {
    public static void main(String[] args) {
        int zero = 1;
        int x = 0;//訂單數(shù)組下標
        String[] name = new String[100];
        int[] time = new int[100];//點餐時間
        String[] menu = new String[100];
        double[] price = new double[100];
        int[] od = new int[100];//訂單序號
        String[] adress = new String[100];//送餐地址
        int[] menuNum = new int[100];//點菜份數(shù)
        String[] yuDing = new String[100];//訂單狀態(tài)
        int a = 0;//點贊數(shù)
        int b = 0;//點贊數(shù)
        int c = 0;//點贊數(shù)
        int panduan = 0;//判斷是否有此訂單
        Scanner sc = new Scanner(System.in);
        do {
            System.out.println("歡迎使用“外賣訂餐系統(tǒng)”");
            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.退出系統(tǒng)");
            System.out.println("******************************");
            System.out.println("請選擇:");
            int num = sc.nextInt();
            while (num < 1 || num > 6) {
                System.out.println("您輸入的選項沒有,重新輸入");
                num = sc.nextInt();
            }
            if (num == 1) {
                od[x] = x + 1;
                yuDing[x] = "已預訂";
                System.out.println("***我要訂餐***");
                System.out.println("請輸入訂餐人姓名:");
                name[x] = sc.next();
                System.out.println("序號" + "          " + "菜名" + "           " + "單價");
                System.out.println(1 + "    " + "紅燒茄子" + "    " + 24.00);
                System.out.println(2 + "    " + "糖醋排骨" + "    " + 36.00);
                System.out.println(3 + "    " + "魚香肉絲" + "    " + 32.00);
                System.out.println("請選擇您想要點的菜品編號:");
                int bianHao = sc.nextInt();
                while (bianHao < 1 || bianHao > 3) {
                    System.out.println("您選擇的菜品沒有,再次輸入");
                    bianHao = sc.nextInt();
                }
                if (bianHao == 1) {
                    menu[x] = "紅燒茄子";
                    price[x] = 24.00;
                } else if (bianHao == 2) {
                    menu[x] = "糖醋排骨";
                    price[x] = 36.00;
                } else if (bianHao == 3) {
                    menu[x] = "魚香肉絲";
                    price[x] = 32.00;
                }
                System.out.println("請選擇您需要的份數(shù):");
                menuNum[x] = sc.nextInt();
                while (menuNum[x] < 1) {
                    System.out.println("您輸入的數(shù)量不合法,再次選擇");
                    menuNum[x] = sc.nextInt();
                }
                System.out.println("請選輸入送餐時間(送餐時間是10點至20點間整點送餐):");
                time[x] = sc.nextInt();
                while (time[x] < 10 || time[x] > 20) {
                    System.out.println("您選擇的時間不在送餐時間內(nèi),再次選擇");
                    time[x] = sc.nextInt();
                }
                System.out.println("請輸入送餐地址");
                adress[x] = sc.next();
                System.out.println("訂餐成功!!!");
                System.out.println("您訂的是:" + menu[x] + " " + menuNum[x] + "份");
                System.out.println("送餐時間:" + time[x] + "點");
                System.out.println("餐費:" + menuNum[x] * price[x] + "元" + " "
                        + "送餐費:6元" + " " + "總計:" + (menuNum[x] * price[x] + 6) + "元");
                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯誤,再次輸入");
                    zero = sc.nextInt();
                }
                x++;
            } else if (num == 2) {
                zero = 1;
                System.out.println("***查看餐帶***");
                System.out.println("序號" + "          " + "訂餐人" + "        " + "餐品信息"
                        + "           " + "送餐時間" + "          " + "送餐地址"
                        + "            " + "總金額" + "           " + "訂單狀態(tài)");
                for (int i = 0; i < x; i++) {
                    if (od[i] != -1) {
                        System.out.println(od[i] + "      " + name[i] + "      " + menu[i]
                                + "       " + time[i] + "        " + adress[i]
                                + "       " + (menuNum[i] * price[i] + 6)
                                + "       " + yuDing[i]);
                    }
                }
                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 3) {
                zero = 1;
                System.out.println("***簽收訂單***");
                System.out.println("請選擇要簽收的訂單的序號:");
                int numc = sc.nextInt();
                for (int i = 0; i < od.length; i++) {
                    if (numc == od[i]) {
                        yuDing[i] = "已簽收";
                        System.out.println("訂單簽收成功!");
                        panduan = 1;
                    }
                }
                if (panduan != 1) {
                    System.out.println("無此訂單");
                }
                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 4) {
                zero = 1;
                panduan = 0;
                System.out.println("***刪除訂單***");
                System.out.println("請選擇要刪除的訂單的序號:");
                int numd = sc.nextInt();
                for (int i = 0; i < od.length; i++) {
                    if (numd == od[i]) {
                        od[i] = -1;
                        System.out.println("訂單刪除成功!");
                        panduan = 1;
                    }
                }
                if (panduan != 1) {
                    System.out.println("無此訂單");
                }
                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 5) {
                zero = 1;
                System.out.println("***我要點贊***");
                System.out.println("序號" + "          " + "菜名" + "           " + "單價");
                System.out.println(1 + "    " + "紅燒茄子" + "    " + 24.00 + " " + a + "贊");
                System.out.println(2 + "    " + "糖醋排骨" + "    " + 36.00 + " " + b + "贊");
                System.out.println(3 + "    " + "魚香肉絲" + "    " + 32.00 + " " + c + "贊");
                System.out.println("請選擇要點贊的菜品的序號:");
                int zan = sc.nextInt();
                while (zan < 1 || zan > 3) {
                    System.out.println("您輸入的序號錯誤,再次輸入");
                    zan = sc.nextInt();
                }
                if (zan == 1) {
                    a++;
                } else if (zan == 2) {
                    b++;
                } else if (zan == 3) {
                    c++;
                }
                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 6) {
                zero = 1;
                System.out.println("謝謝使用,歡迎下次光臨!");
                return;
            }
        } while (zero == 0);
    }
}

以上就是本文的全部內(nèi)容,希望對你們的學習有所幫助,也希望你們多多支持腳本之家。

免責聲明:部分文章信息來源于網(wǎng)絡(luò)以及網(wǎng)友投稿,本站只負責對文章進行整理、排版、編輯,出于傳遞更多信息之目的,并不意味著贊同其觀點或證實其內(nèi)容的真實性,如本站文章和轉(zhuǎn)稿涉及版權(quán)等問題,請作者在及時聯(lián)系本站,我們會盡快為您處理。

歡樂點

留言咨詢

×