日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

c语言 系统 dome,订餐系统(Dome)

發布時間:2025/3/12 windows 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言 系统 dome,订餐系统(Dome) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import java.util.Scanner;

public class OrderingMsg {

public static void main(String[] args) throws Exception {

Scanner scanner = new Scanner(System.in);

String[] names = new String[6]; // 訂餐人姓名

String[] dishMsgs = new String[6];// 選擇菜品

int[] numbers = new int[6];// 菜品份數

int[] times = new int[6]; // 送餐時間

String[] addresses = new String[6];// 送餐地址

int[] states = new int[6];// 訂單狀態 0:已經預定 1:已經完成

double[] sumPrices = new double[6];// 總金額

int[] praiseNums = new int[6];

String[] dishNames = { "北京烤鴨", "麻婆豆腐", "松鼠魚", "紅燒帶魚", "時令蔬菜", "辣土豆絲" };

double[] prices = { 88, 24, 38, 35, 15, 12 };

System.out.println("歡迎進入surper訂餐系統");

int num = -1; // 輸入0 默認返回主菜單

boolean isExit = false;// 默認不退出

do {

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:退出系統");

System.out.println("**********************");

System.out.println("請選擇:");

int choice = scanner.nextInt(); //選擇你所需要的服務

switch (choice) {

case 1:

System.out.println("************我要訂餐************");

boolean empty = false;//作一個標記

for (int i = 0; i < names.length; i++) { // 訂餐人的集合

if (names[i] == null) {

empty = true;//訂單如果是空的,便可以往里加數據

System.out.println("請輸入訂餐人的姓名:");

names[i] = scanner.next(); // 獲取訂餐人的姓名

System.out.println("您可以選擇下列的菜品:");

System.out.println("序號\t\t\t菜名\t\t\t單價\t\t\t點贊數");

for (int j = 0; j < dishNames.length; j++) { // 遍歷菜品

String praiseNum = (praiseNums[j] > 0) ? praiseNums[j]

+ "個贊"

: "";

System.out.println(j + 1 + "\t\t\t" + dishNames[j]

+ "\t\t\t" + prices[j] + "\t\t\t"

+ praiseNum);

}

// 用戶開始點菜,并收集信息

System.out.println("請您選擇菜品的編號:");

int choiceName = scanner.nextInt();

System.out.println("請您輸入點餐的份數:");

int number = scanner.nextInt();

System.out.println("請您輸入送餐的地址:");

String address = scanner.next();

System.out.println("請您輸入送餐的時間:");

System.out.println("本店整點送餐:8點至20點");

int time = scanner.nextInt();

double sumPrice = prices[choiceName - 1] * number;

double price = (sumPrice >=50) ? 0 : 5;//判斷是否收取運費

System.out.println("訂單已生成!");

System.out.println("您定的菜品是:"+ dishNames[choiceName - 1] + "\t" + number+ "份");

System.out.print("餐費:" + sumPrice);

System.out.print("\t送餐費:" + price);

System.out.println("\t總費用:" + (price + sumPrice));

// 把輸入的信息塞進數組中

times[i] = time; // 時間

addresses[i] = address; // 地址

sumPrices[i] = (sumPrice + price); // 總金額

dishMsgs[i] = dishNames[choiceName - 1]; // 定的菜品

states[i] = 0; // 訂餐的狀態

numbers[i] = number; // 份數

break;

}

}

if (!empty) {// 餐袋已經滿了

System.out.println("餐袋已經滿了");

}

break;

case 2:

System.out.println("************查看餐袋************");

System.out.println("編號\t\t訂餐人\t\t菜品(份數)\t\t送餐時間 \t\t送餐地址\t\t總金額\t\t狀態\t\t點贊數量");

for (int i = 0; i < names.length; i++) {

if (names[i] != null) { // 有人訂餐 的顯示

String state = (states[i] == 0) ? "已經預定" : "已經完成"; // 獲取狀態

int time = times[i]; // 時間

String sumPrice = sumPrices[i] + "元"; // 總金額

String address = addresses[i]; // 地址

String dishMsg = dishMsgs[i]; // 菜品

int count = numbers[i];//份數

System.out.println((i + 1) + "\t\t" + names[i] + "\t\t"+ dishMsg + "(" + count + ")" + "\t\t" + time+ " \t\t" + address + "\t\t" + sumPrice+ "\t\t" + state + "\t\t" + praiseNums[i]);

}

}

break;

case 3:

System.out.println("************簽收訂單************");

System.out.println("請您輸入需要簽收的訂單編號:");

int sign = scanner.nextInt();

int flag = 0;// 作一個標記,來判斷訂單是否被簽收

for (int i = 0; i < names.length; i++) {

if (names[i] != null && states[i] == 0) {//有訂單并且可以簽收

states[i] = 1;// 改變狀態

flag = 1;

break;

} else if (names[i] != null && states[i] == 1) {//有訂單,并且已被簽收

flag = 2;

}

}

if (flag == 1) {

System.out.println("訂單已經簽收!");

} else if (flag == 2) {

System.out.println("訂單不能重復簽收!");

} else {

System.out.println("沒有找到您的訂單!請您核對編號!");

}

break;

case 4:

System.out.println("************刪除訂單************");

System.out.println("請您輸入需要刪除的訂單編號:");

int dealNum = scanner.nextInt();

int deal = 0; // 作一個標記 來判斷訂單是否被簽收以及是否存在

for (int i = 0; i < names.length; i++) {

if (names[i] != null && states[dealNum - 1] == 1) { //有訂單,并且已簽收,可以刪除

// 刪除一條信息,將之后的所有信息,依次向前移

for (int j = dealNum - 1; j < names.length - 1; j++) {

names[j] = names[j + 1]; // 訂餐人

dishMsgs[j] = dishMsgs[j + 1];// 菜品

times[j] = times[j + 1];// 時間

addresses[j] = addresses[j + 1];// 地址

states[j] = states[j + 1];// 狀態

numbers[j] = numbers[j + 1];// 份數

}

deal = 1;

break;

} else if (names[i] != null && states[i] == 0) { // 右訂單并且訂單還沒有簽收,便不能刪除

deal = 2;

}

}

if (deal == 1) {

System.out.println("訂單已經被刪除");

} else if (deal == 2) {

System.out.println("訂單還沒有簽收 不允許刪除!");

} else {

System.out.println("沒有找到指定的訂單!");

}

break;

case 5:

System.out.println("************我要點贊***************");

System.out.println("編號\t\t\t菜名\t\t\t價格");

for (int i = 0; i < dishNames.length; i++) { // 遍歷所有的菜名

String price = prices[i] + "元"; //價格

String name = dishNames[i];//菜名

System.out.println((i + 1) + "\t\t\t" + name + "\t\t\t"+ price);

}

System.out.println("請您輸入點贊的菜品編號:");

int choiceNum = scanner.nextInt();

praiseNums[choiceNum - 1]++;// 點贊數累加

System.out.println("謝謝參與!點贊成功!");

break;

case 6:

// 退出系統

isExit = true;

break;

default:

// 退出系統

isExit = true;

break;

}

if (!isExit) { // 默認這是不退出

System.out.println("輸入0返回主菜單!");

num = scanner.nextInt();

} else {

break; // 退出系統

}

} while (num == 0);

System.out.println("謝謝您的光臨!!!!!");}

}

總結

以上是生活随笔為你收集整理的c语言 系统 dome,订餐系统(Dome)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。