Java练习小项目01(1),2021最新大厂Java面试集合

Java练习小项目01(1),2021最新大厂Java面试集合,第1张

Java练习小项目01(1),2021最新大厂Java面试集合

like[k] = n;

menu[k] = n1;

price[k] = n2;

}

}

}

for (int j = 0; j < 3; j++) {

System.out.println((j+1)+"t"+menu[j]+" "+price[j]);

}

System.out.println(“请选择您要点的菜品编号:”);

int x2 = num.nextInt();

for (int i = 0; i < 100; i++) {

if(caipin[i] == null){

caipin[i] = menu[x2-1];

break;

}

}

System.out.println(“请选择您需要的份数:”);

int x3 = num.nextInt();

for (int i = 0; i < 100; i++) {

if(sum[i] == 0){

sum[i] = x3;

break;

}

}

System.out.println(“请输入送餐时间:”);

String x4 = num.next();

for (int i = 0; i < 100; i++) {

if(times[i] == null){

times[i] = x4;

break;

}

}

System.out.println(“请输入送餐地址:”);

String x5 = num.next();

for (int i = 0; i < 100; i++) {

if(site[i] == null){

site[i] = x5;

break;

}

}

for (int i = 0; i < 100; i++) {

if(money[i] == 0){

money[i] = price[x2-1]*sum[i];

System.out.println(“订餐成功!”);

System.out.println(“您订的是:”+caipin[i]+" "+sum[i]+“份”);

System.out.println(“送餐时间:”+times[i]);

System.out.println(“餐费:”+money[i]+“元”+“送餐费:0元”+“总计”+money[i]+“元”);

// count = i;

// System.out.println(count);

break;

}

}

break;

case 2:

System.out.println(“查看餐袋”);

System.out.println(“序号t”+“订餐人t”+“餐品信息t”+“送餐日期t”+“送餐地址t”+“总金额t”+“订单状态t”);

for (int i = 0; i < 100; i++) {

if(name[i] == null){

count = i;

break;

}

}

for (int i = 0; i < count; i++) {

System.out.println((i+1)+" “+name[i]+” “+caipin[i]+sum[i]+“份”+” “+times[i]+” "+

site[i]+" “+money[i]+” "+(stste[i]==0?“已预订”:“已完成”));

}

break;

case 3:

System.out.println(“签收订单”);

System.out.println(“请选择需要签收的订单序号:”);

int x6 = num.nextInt();

stste[x6-1] = 1;

System.out.println(“订单签收成功!”);

break;

case 4:

System.out.println(“删除订单”);

System.out.println(“请输入需要删除的订单序号:”);

int x7 = num.nextInt();

if(stste[x7-1] == 0){

System.out.println(“您选择的订单未签收,不能删除!”);

}else{

for (int i = x7-1; i < name.length; i++) {

if(name[i] == null){

break;

}else{

name[i] = name[i+1];

caipin[i] = caipin[i+1];

sum[i] = sum[i+1];

times[i] = times[i+1];

site[i] = site[i+1];

money[i] = money[i+1];

stste[i] = stste[i+1];

}

}

System.out.println(“您选择的订单已成功删除!”);

}

break;

case 5:

System.out.println(“我要点赞”);

System.out.println(“请输入您要点赞的菜品序号:”);

int y = num.nextInt();

like[y-1]++;

break;

default:

System.out.println(“祝您用餐愉快,欢迎下次光临!”);

break;

}

if(m == 6){

break;

}else{

System.out.println(“输入0返回:”);

int n = num.nextInt();

}

}while(true);

}

}

(集合)顾客点餐系统

==========

import java.util.*;

public class XiangMu2 {

public static void main(String[] args) {

List name = new ArrayList<>();

List caipin = new ArrayList<>();

List sum = new ArrayList<>();

List times = new ArrayList<>();

List site = new ArrayList<>();

List money = new ArrayList<>();

linkedList stste = new linkedList<>();

Map menu = new HashMap<>();

// linkedList menu = new linkedList<>();

menu.put(0,“清蒸魚”);

menu.put(1,“爆炒大虾”);

menu.put(2,“麻婆豆腐”);

Map price = new HashMap<>();

// linkedList price = new linkedList<>();

price.put(0,58.9);

price.put(1,38.9);

price.put(2,18.9);

Map like = new HashMap<>();

System.out.println(“欢迎使用快跑订餐系统”);

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(“请选择:”);

Scanner num = new Scanner(System.in);

int m = num.nextInt();

int count = 0;

switch(m){

case 1:

System.out.println(“我要订餐”);

System.out.println(“请输入订餐人姓名:”);

name.add(num.next());

System.out.println(“序号t”+“菜名t”+“单价t”);

for (int j = 0; j < 3; j++) {

System.out.println((j+1)+"t"+menu.get(j)+" "+price.get(j));

}

System.out.println(“请选择您要点的菜品编号:”);

int x2 = num.nextInt()-1;

caipin.add(menu.get(x2));

System.out.println(“请选择您需要的份数:”);

int x3 = num.nextInt();

sum.add(x3);

System.out.println(“请输入送餐时间:”);

String x4 = num.next();

times.add(x4);

System.out.println(“请输入送餐地址:”);

String x5 = num.next();

site.add(x5);

money.add((price.get(x2) * x3));

System.out.println(“订餐成功!”);

System.out.println(“您订的是:”+menu.get(x2)+" "+x3+“份”);

System.out.println(“送餐时间:”+x4);

System.out.println(“餐费:”+(price.get(x2) * x3)+“元”+“送餐费:0元”+“总计”+(price.get(x2) * x3)+“元”);

stste.add(0);

break;

case 2:

System.out.println(“查看餐袋”);

System.out.println(“序号t”+“订餐人t”+“餐品信息t”+“送餐日期t”+“送餐地址t”+“总金额t”+“订单状态t”);

for (int i = 0; i < name.size(); i++) {

System.out.println((i+1)+" “+name.get(i)+” “+caipin.get(i)+” “+times.get(i)+” "+

site.get(i)+" “+money.get(i)+” "+((stste.get(i) == 0)?“已预订”:“已完成”));

【一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义】

浏览器打开:qq.cn.hn/FTf 免费领取

}

break;

case 3:

System.out.println(“签收订单”);

System.out.println(“请选择需要签收的订单序号:”);

int x6 = num.nextInt()-1;

stste.remove(x6);

stste.add(x6,1);

System.out.println(“订单签收成功!”);

break;

case 4:

System.out.println(“删除订单”);

System.out.println(“请输入需要删除的订单序号:”);

int x7 = num.nextInt()-1;

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5438521.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-11
下一篇 2022-12-11

发表评论

登录后才能评论

评论列表(0条)

保存