这篇文章主要为大家详细介绍了java实现外卖订餐系统,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了java实现外卖订餐系统的具体代码,供大家参考,具体内容如下
一、使用技术
javaSE
二、实现功能
外卖订餐系统
具体要求如下:
使用选择结构,循环结构,数组的知识实现一个外卖订餐系统
三、运行效果图
1.订餐功能
2.查看餐袋
3.签收订单
4.删除订单
5.点赞
6.退出
分析图片信息,可以看出我们需要创建一个菜单类,查看餐带类和点赞菜单类
1.首先我们创建一个菜单类,用来定义菜单的属性,使用到封装,构造方法,和toString方法。
public class Food {
//菜单
@Override
public String toString() {
return "Food{" +
"num=" + num +
", name='" + name + '\'' +
", price=" + price +
'}';
}
private int num;
private String name;
private double price;
public Food() {
}
public Food(int num, String name, double price) {
this.num = num;
this.name = name;
this.price = price;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
2.其次,我们在创建一个查看餐袋类
public class SeeFood {
//查看餐带
private int num;//序号
private String name;//订餐人
//private String information;//信息
private String food;//菜品
private int num1;//份数
private int date;//送餐日期
private String address;//送餐地址
private double money;//金额
private String state;//订单状态
@Override
public String toString() {
return "SeeFood{" +
"num=" + num +
", name='" + name + '\'' +
", food='" + food + '\'' +
", num1=" + num1 +
", date='" + date + '\'' +
", address='" + address + '\'' +
", money=" + money +
", state='" + state + '\'' +
'}';
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFood() {
return food;
}
public void setFood(String food) {
this.food = food;
}
public int getNum1() {
return num1;
}
public void setNum1(int num1) {
this.num1 = num1;
}
public int getDate() {
return date;
}
public void setDate(int date) {
this.date = date;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public double getMoney() {
return money;
}
public void setMoney(double money) {
this.money = money;
}
public String