欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

java實(shí)現(xiàn)簡(jiǎn)易外賣(mài)訂餐系統(tǒng)

 更新時(shí)間:2021年10月04日 10:25:07   作者:Вадим  
這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)簡(jiǎn)易外賣(mài)訂餐系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

用java實(shí)現(xiàn)簡(jiǎn)易外賣(mài)訂餐系統(tǒng),供大家參考,具體內(nèi)容如下

一、使用技術(shù)

javaSE

二、實(shí)現(xiàn)功能

外賣(mài)訂餐系統(tǒng)

具體要求如下:

使用選擇結(jié)構(gòu),循環(huán)結(jié)構(gòu),數(shù)組的知識(shí)實(shí)現(xiàn)一個(gè)外賣(mài)訂餐系統(tǒng)

三、運(yùn)行效果圖

1.訂餐功能

2.查看餐袋

3.簽收訂單

4.刪除訂單

5.點(diǎn)贊

6.退出

代碼實(shí)現(xiàn)

public class Order {
    public static void main(String[] args) {
        int zero = 1;
        int x = 0;//訂單數(shù)組下標(biāo)

        String[] name = new String[100];
        int[] time = new int[100];//點(diǎn)餐時(shí)間
        String[] menu = new String[100];
        double[] price = new double[100];
        int[] od = new int[100];//訂單序號(hào)
        String[] adress = new String[100];//送餐地址
        int[] menuNum = new int[100];//點(diǎn)菜份數(shù)
        String[] yuDing = new String[100];//訂單狀態(tài)

        int a = 0;//點(diǎn)贊數(shù)
        int b = 0;//點(diǎn)贊數(shù)
        int c = 0;//點(diǎn)贊數(shù)
        int panduan = 0;//判斷是否有此訂單
        Scanner sc = new Scanner(System.in);
        do {
            System.out.println("歡迎使用“外賣(mài)訂餐系統(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.我要點(diǎn)贊");
            System.out.println("6.退出系統(tǒng)");
            System.out.println("******************************");
            System.out.println("請(qǐng)選擇:");
            int num = sc.nextInt();
            while (num < 1 || num > 6) {
                System.out.println("您輸入的選項(xiàng)沒(méi)有,重新輸入");
                num = sc.nextInt();
            }
            if (num == 1) {
                od[x] = x + 1;
                yuDing[x] = "已預(yù)訂";
                System.out.println("***我要訂餐***");
                System.out.println("請(qǐng)輸入訂餐人姓名:");
                name[x] = sc.next();
                System.out.println("序號(hào)" + "          " + "菜名" + "           " + "單價(jià)");
                System.out.println(1 + "    " + "紅燒茄子" + "    " + 24.00);
                System.out.println(2 + "    " + "糖醋排骨" + "    " + 36.00);
                System.out.println(3 + "    " + "魚(yú)香肉絲" + "    " + 32.00);
                System.out.println("請(qǐng)選擇您想要點(diǎn)的菜品編號(hào):");
                int bianHao = sc.nextInt();
                while (bianHao < 1 || bianHao > 3) {
                    System.out.println("您選擇的菜品沒(méi)有,再次輸入");
                    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] = "魚(yú)香肉絲";
                    price[x] = 32.00;
                }
                System.out.println("請(qǐng)選擇您需要的份數(shù):");
                menuNum[x] = sc.nextInt();
                while (menuNum[x] < 1) {
                    System.out.println("您輸入的數(shù)量不合法,再次選擇");
                    menuNum[x] = sc.nextInt();
                }

                System.out.println("請(qǐng)選輸入送餐時(shí)間(送餐時(shí)間是10點(diǎn)至20點(diǎn)間整點(diǎn)送餐):");
                time[x] = sc.nextInt();
                while (time[x] < 10 || time[x] > 20) {
                    System.out.println("您選擇的時(shí)間不在送餐時(shí)間內(nèi),再次選擇");
                    time[x] = sc.nextInt();
                }

                System.out.println("請(qǐng)輸入送餐地址");
                adress[x] = sc.next();

                System.out.println("訂餐成功?。?!");
                System.out.println("您訂的是:" + menu[x] + " " + menuNum[x] + "份");
                System.out.println("送餐時(shí)間:" + time[x] + "點(diǎn)");
                System.out.println("餐費(fèi):" + menuNum[x] * price[x] + "元" + " "
                        + "送餐費(fèi):6元" + " " + "總計(jì):" + (menuNum[x] * price[x] + 6) + "元");

                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯(cuò)誤,再次輸入");
                    zero = sc.nextInt();
                }

                x++;
            } else if (num == 2) {
                zero = 1;

                System.out.println("***查看餐帶***");
                System.out.println("序號(hào)" + "          " + "訂餐人" + "        " + "餐品信息"
                        + "           " + "送餐時(shí)間" + "          " + "送餐地址"
                        + "            " + "總金額" + "           " + "訂單狀態(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("輸入錯(cuò)誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 3) {
                zero = 1;

                System.out.println("***簽收訂單***");
                System.out.println("請(qǐng)選擇要簽收的訂單的序號(hào):");
                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("無(wú)此訂單");
                }


                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯(cuò)誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 4) {
                zero = 1;
                panduan = 0;
                System.out.println("***刪除訂單***");
                System.out.println("請(qǐng)選擇要?jiǎng)h除的訂單的序號(hào):");
                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("無(wú)此訂單");
                }
                System.out.println("輸入0返回:");
                zero = sc.nextInt();
                while (zero != 0) {
                    System.out.println("輸入錯(cuò)誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 5) {
                zero = 1;
                System.out.println("***我要點(diǎn)贊***");
                System.out.println("序號(hào)" + "          " + "菜名" + "           " + "單價(jià)");
                System.out.println(1 + "    " + "紅燒茄子" + "    " + 24.00 + " " + a + "贊");
                System.out.println(2 + "    " + "糖醋排骨" + "    " + 36.00 + " " + b + "贊");
                System.out.println(3 + "    " + "魚(yú)香肉絲" + "    " + 32.00 + " " + c + "贊");
                System.out.println("請(qǐng)選擇要點(diǎn)贊的菜品的序號(hào):");
                int zan = sc.nextInt();
                while (zan < 1 || zan > 3) {
                    System.out.println("您輸入的序號(hào)錯(cuò)誤,再次輸入");
                    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("輸入錯(cuò)誤,再次輸入");
                    zero = sc.nextInt();
                }
            } else if (num == 6) {
                zero = 1;
                System.out.println("謝謝使用,歡迎下次光臨!");
                return;
            }

        } while (zero == 0);

    }
}

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

相關(guān)文章

  • Java實(shí)現(xiàn)PDF文件的分割與加密功能

    Java實(shí)現(xiàn)PDF文件的分割與加密功能

    這篇文章主要為大家分享了如何利用Java語(yǔ)言實(shí)現(xiàn)PDF文件的分割與加密以及封面圖的生成,文中的示例代碼簡(jiǎn)潔易懂,感興趣的可以了解一下
    2022-04-04
  • Java 實(shí)現(xiàn)萬(wàn)年歷總結(jié)

    Java 實(shí)現(xiàn)萬(wàn)年歷總結(jié)

    這篇文章主要介紹了Java 萬(wàn)年歷實(shí)現(xiàn)代碼的相關(guān)資料,需要的朋友可以參考下
    2016-09-09
  • Spring Boot之內(nèi)嵌tomcat版本升級(jí)操作示例

    Spring Boot之內(nèi)嵌tomcat版本升級(jí)操作示例

    這篇文章主要為大家介紹了Spring Boot之內(nèi)嵌tomcat版本升級(jí)操作示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-06-06
  • Java中的static關(guān)鍵字深入理解

    Java中的static關(guān)鍵字深入理解

    這篇文章主要介紹了Java中的static關(guān)鍵字深入理解,文字和代碼列舉了實(shí)際例子,有感興趣的同學(xué)可以研究下
    2021-03-03
  • Spring rest接口中的LocalDateTime日期類(lèi)型轉(zhuǎn)時(shí)間戳

    Spring rest接口中的LocalDateTime日期類(lèi)型轉(zhuǎn)時(shí)間戳

    這篇文章主要介紹了Spring rest接口中的LocalDateTime日期類(lèi)型轉(zhuǎn)時(shí)間戳的方法,Java程序中一般將日期類(lèi)型定義為L(zhǎng)ocalDateTime,數(shù)據(jù)庫(kù)中保存的時(shí)間是0時(shí)區(qū)的時(shí)間
    2023-03-03
  • Mybatis的介紹、基本使用、高級(jí)使用

    Mybatis的介紹、基本使用、高級(jí)使用

    這篇文章主要介紹了Mybatis的介紹、基本使用、高級(jí)使用,Mybatis是一款半自動(dòng)的ORM持久層框架,具有較高的SQL靈活性,如何使用看這篇就夠了,需要的朋友可以參考下
    2023-03-03
  • Mybatis 中的sql批量修改方法實(shí)現(xiàn)

    Mybatis 中的sql批量修改方法實(shí)現(xiàn)

    在項(xiàng)目中遇到需要批量更新的功能,原本想的是在Java中用循環(huán)訪問(wèn)數(shù)據(jù)庫(kù)去更新,但是心里總覺(jué)得這樣做會(huì)不會(huì)太頻繁了,太耗費(fèi)資源了,效率也很低,查了下mybatis的批量操作,原來(lái)確實(shí)有<foreach>標(biāo)簽可以做到,下面通過(guò)本文給大家介紹下
    2017-01-01
  • java正則表達(dá)式對(duì)特殊字符的轉(zhuǎn)義以及異常現(xiàn)象

    java正則表達(dá)式對(duì)特殊字符的轉(zhuǎn)義以及異?,F(xiàn)象

    這篇文章主要給大家介紹了關(guān)于java正則表達(dá)式對(duì)特殊字符的轉(zhuǎn)義以及異?,F(xiàn)象的相關(guān)資料,在Java中使用正則表達(dá)式匹配特殊字符也需要使用轉(zhuǎn)義字符"\",需要的朋友可以參考下
    2023-06-06
  • springboot數(shù)據(jù)庫(kù)密碼加密的配置方法

    springboot數(shù)據(jù)庫(kù)密碼加密的配置方法

    這篇文章主要給大家介紹了關(guān)于springboot數(shù)據(jù)庫(kù)密碼加密的配置方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-04-04
  • Spring Boot使用AOP防止重復(fù)提交的方法示例

    Spring Boot使用AOP防止重復(fù)提交的方法示例

    這篇文章主要介紹了Spring Boot使用AOP防止重復(fù)提交的方法示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2019-05-05

最新評(píng)論