JAVA基础学习笔记 day006_作业02(点餐小程序训练)


import java.util.Scanner;

public class OrderingMrg {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		String[] name = new String[4];//保存订餐人姓名
		String[] dishMegs = new String[4];//保存所选信息,包括菜品名和份数
		int[] times = new int[4];//保存送餐时间
		String[] addresses = new String[4];//保存送餐地址
		int[] states = new int[4];//保存订单状态:0表示已预定,1表示已完成
		double[] sumPrices = new double[4];//保存订单总金额
		
		String[] dishNames = {"红烧带鱼", "鱼香肉丝", "时令鲜蔬"};
		double[] price = {38.0, 20.0, 10.0};
		int[] praiseNums = new int[3];
		
		name[0] = "张三";
		dishMegs[0] = "红烧带鱼 2份";
		times[0] = 12;
		addresses[0] = "天成路207号";
		sumPrices[0] = 76.0;
		states[0] = 1;
		
		name[1] = "李四";
		dishMegs[1] = "鱼香肉丝 2份";
		times[1] = 18;
		addresses[1] = "天成路702号";
		sumPrices[1] = 45.0;
		states[1] = 0;
		
		System.out.println("欢迎使用\"吃货联盟订餐系统\"");
		int num;
		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.print("请选择:");
			num = input.nextInt();
			switch (num) {
			case 1:
				//判断订单有没有满,满了的话就直接跳过case1
				int g = 0;
				for(int i=0; i=10 && ord_times<=20){
						break;
					}
					System.out.println("请输入正确的送餐时间!");
					ord_times = input.nextInt();
				}
				
				System.out.println("请输入订餐地址:");
				String ord_address = input.next();
				
				//计算总价并且判断是否需要送餐费
				double ord_sumPrices = price[chooseDish-1] * chooseDish_nums;
				int deliCharge = ord_sumPrices>=50?0:5;
				
				for(int i=0; i

 

你可能感兴趣的:(作业)