傻瓜式外卖点餐系统(无数据库)
tips:
菜品类(菜品id,菜品名,菜品类型,上架时间,单价,月销售,总数量)
管理员类(管理员id,账号,密码)
客户类(客户id,客户名,性别,密码,送餐地址,手机号,创建时间)
订单类(订单号,订单创建时间,菜品id,购买数,客户id,总价格,订单状态)
说明:
菜品类型可自行设计数据类型(int或String),如1:面食 2:米饭 3:湘菜 …
菜品上架时间、客户创建时间、订单创建时间根据添加时间自动分配系统时间
订单状态类型为int(0:未支付 1:已支付 2:配送中 3:已完成)
要求实现如下功能:
实现不同角色用户登录系统
(1) 管理员登录系统看到如下菜单:
① 添加菜品
② 查看所有菜品信息(包含分页功能)
③ 查看指定类别的菜品信息
④ 根据菜品id修改菜品价格
⑤ 删除指定id的菜品
⑥ 添加客户
⑦ 查看客户列表
⑧ 删除指定id的客户
⑨ 订单列表显示
⑩ 根据订单id修改订单状态
11 退出
(2) 客户登录看到如下菜单:
① 显示所有菜品(按菜品销量从高到低排序输出)
-------->点餐(输入菜品id和购买数量)
② 根据菜品类别显示所有菜品
③ 查看所有订单(当前登录用户的)
④ 修改密码(当前登录用户的)
⑤ 个人信息显示
以上就是全部要求,首先咱们可以先建一个接口,方便对四个管理类进行操作;
packagecom.softeem.lesson23.test2;importjava.util.List;public interface DAO{voidinsert(T t);
T findById(String id);
ListfindAll();voiddelete(String id);
}
一、再根据要求,先把四个类的属性类建立起来:
1. Admin类(管理员类)
packagecom.softeem.lesson23.test2;public classAdmin {privateString aID;privateString account;privateString apwd;publicAdmin() {//TODO Auto-generated constructor stub
}publicAdmin(String aID, String account, String apwd) {super();this.aID =aID;this.account =account;this.apwd =apwd;
}publicString getaID() {returnaID;
}public voidsetaID(String aID) {this.aID =aID;
}publicString getAccount() {returnaccount;
}public voidsetAccount(String account) {this.account =account;
}publicString getApwd() {returnapwd;
}public voidsetApwd(String apwd) {this.apwd =apwd;
}
@OverridepublicString toString() {return "Admin [aID=" + aID + ", account=" + account + ", apwd=" + apwd + "]";
}
}
2.Dishes类(菜品类)
packagecom.softeem.lesson23.test2;importjava.time.LocalDate;public classDishes {privateString dID;privateString dname;privateString dtype;privateLocalDate dtime;private doubleprice;private intdsales;private intdstocks;publicDishes() {//TODO Auto-generated constructor stub
}public Dishes(String dID, String dname, String dtype, LocalDate dtime, double price, int dsales, intdstocks) {super();this.dID =dID;this.dname =dname;this.dtype =dtype;this.dtime =dtime;this.price =price;this.dsales =dsales;this.dstocks =dstocks;
}publicString getdID() {returndID;
}public voidsetdID(String dID) {this.dID =dID;
}publicString getDname() {returndname;
}public voidsetDname(String dname) {this.dname =dname;
}publicString getDtype() {returndtype;
}public voidsetDtype(String dtype) {this.dtype =dtype;
}publicLocalDate getDtime() {returndtime;
}public voidsetDtime(LocalDate dtime) {this.dtime =dtime;
}public doublegetPrice() {returnprice;
}public void setPrice(doubleprice) {this.price =price;
}public intgetDsales() {returndsales;
}public void setDsales(intdsales) {this.dsales =dsales;
}public intgetDstocks() {returndstocks;
}public void setDstocks(intdstocks) {this.dstocks =dstocks;
}
@OverridepublicString toString() {return "Dishes [菜品id:" + dID + ", 菜品名:" + dname + ", 菜品类型:" + dtype + ", 上架时间:" + dtime + ", 单价:" +price+ ", 月销量:" + dsales + ", 总数量:" + dstocks + "]";
}
}
3. Order类(订单类)
packagecom.softeem.lesson23.test2;importjava.time.LocalDateTime;public classOrder {privateString OrderID;privateLocalDateTime utime;privateDishes dishes;private intOrdernum;privateString uID;privateDouble Orderprice;private intOrderValue;publicOrder() {//TODO Auto-generated constructor stub
}public Order(String orderID, LocalDateTime utime, Dishes dishes, intordernum, String uID, Double orderprice,intorderValue) {super();
OrderID=orderID;this.utime =utime;this.dishes =dishes;
Ordernum=ordernum;this.uID =uID;
Orderprice=orderprice;
OrderValue=orderValue;
}publicString getOrderID() {returnOrderID;
}public voidsetOrderID(String orderID) {
OrderID=orderID;
}publicLocalDateTime getUtime() {returnutime;
}public voidsetUtime(LocalDateTime utime) {this.utime =utime;
}publicDouble getOrderprice() {returnOrderprice;
}public voidsetOrderprice(Double orderprice) {
Orderprice=orderprice;
}publicDishes getDishes() {returndishes;
}public voidsetDishes(Dishes dishes) {this.dishes =dishes;
}public intgetOrdernum() {returnOrdernum;
}public void setOrdernum(intordernum) {
Ordernum=ordernum;
}publicString getuID() {returnuID;
}public voidsetuID(String uID) {this.uID =uID;
}public intgetOrderValue() {returnOrderValue;
}public void setOrderValue(intorderValue) {
OrderValue=orderValue;
}
@OverridepublicString toString() {return "Order [OrderID=" + OrderID + ", utime=" + utime + ", dishes=" + dishes + ", Ordernum=" +Ordernum+ ", uID=" + uID + ", Orderprice=" + Orderprice + ", OrderValue=" + OrderValue + "]";
}
}
4. User类(用户类)
packagecom.softeem.lesson23.test2;importjava.time.LocalDateTime;public classUser {privateString uID;privateString uname;privateString usex;privateString upwd;privateString uadress;privateString utel;privateLocalDateTime utime;publicUser() {//TODO Auto-generated constructor stub
}publicUser(String uID, String uname, String usex, String upwd, String uadress, String utel, LocalDateTime utime) {super();this.uID =uID;this.uname =uname;this.usex =usex;this.upwd =upwd;this.uadress =uadress;this.utel =utel;this.utime =utime;
}publicString getuID() {returnuID;
}public voidsetuID(String uID) {this.uID =uID;
}publicString getUname() {returnuname;
}public voidsetUname(String uname) {this.uname =uname;
}publicString getUsex() {returnusex;
}public voidsetUsex(String usex) {this.usex =usex;
}publicString getUpwd() {returnupwd;
}public voidsetUpwd(String upwd) {this.upwd =upwd;
}publicString getUadress() {returnuadress;
}public voidsetUadress(String uadress) {this.uadress =uadress;
}publicString getUtel() {returnutel;
}public voidsetUtel(String utel) {this.utel =utel;
}publicLocalDateTime getUtime() {returnutime;
}public voidsetUtime(LocalDateTime utime) {this.utime =utime;
}
@OverridepublicString toString() {return "User [uID=" + uID + ", uname=" + uname + ", usex=" + usex + ", upwd=" + upwd + ", uadress=" +uadress+ ", utel=" + utel + ", utime=" + utime + "]";
}
}
这一步没什么难度,直接把每一个属性都设置一下,然后设置为私有,注意属性的数据类型,这个很重要,方便后期管理类对其进行操作。
二、属性管理类
这个是整个demo比较难得地方,我的想法是建立Admin属性管理类,Order属性管理类,Dishes属性类,User属性管理类,再在Admin属性管理类里把Order属性管理类,Dishes属性类,User属性管理类先new出来,然后,每个属性管理类实现各自的方法,只需要在Admin属性管理类中调用各个属性管理类的方法,就可以实现通过Admin类管理其他类的数据,但是,每个类需要建一个Map集合,存储各自的元素,此处应该注意每个属性管理类Map的键方便后期对Map进行操作,然后建立菜单类,规定User和Admin能调用的方法。
话不多说,直接上代码,一下代码是通过Admin管理类延伸的,所以先看Admin管理类。
1. Admin管理类
packagecom.softeem.lesson23.test2;importjava.time.LocalDate;importjava.time.LocalDateTime;//import java.util.ArrayList;
importjava.util.Collections;importjava.util.HashMap;importjava.util.List;importjava.util.Map;importjava.util.Scanner;//import java.util.Set;
public class AdminSys implements DAO{static Map map = new HashMap<>();//static Set keys = map.keySet();
UserSys u = newUserSys();
OrderSys o= newOrderSys();
DishesSys d= newDishesSys();
Scanner sc= newScanner(System.in);/*** 添加菜品*/
public voidaddDishes() {
System.out.println("请输入您要添加的菜品:(按照:菜品ID/菜品名/菜品类型/单价/月销量/总数量)");
String str=sc.next();
String[] info= str.split("/");// if (info.length < 6) {
System.out.println("天啦撸,输入失败啦,请重新输入!");
addDishes();
}else{
LocalDate dtime=LocalDate.now();
Dishes t= new Dishes(info[0], info[1], info[2], dtime, Double.parseDouble(info[3]),
Integer.parseInt(info[4]), Integer.parseInt(info[5]));
d.insert(t);
System.out.println("小主,恭喜你!添加成功了");
}
}/*** 查看所有菜品信息(包含分页功能)*/
public void showAllDishes(intpageSize) {
List list =d.findAll();int start = 0;//先写一个死循环,进入else后break掉
while (true) {if (list.size() > (pageSize +start)) {
System.out.println(list.subList(start, pageSize+start));
}else{
System.out.println(list.subList(start, list.size()));break;
}
start= start +pageSize;
}
}/*** 查看指定类别的菜品信息
**/
public voidselecBytypeOfAdmin() {
System.out.println("请输入您要查询菜品的类别:");
String typename=sc.next();
d.selectBytype(typename);
}/*** 根据菜品id修改菜品价格*/
public voidselectByDishesID() {
System.out.println("请输入您要查询的菜品id:");
String id=sc.next();
Dishes dish=d.findById(id);if (dish == null) {
System.out.println("没有当前id的菜品呢");
}else{
System.out.println("当前菜品为:" +dish);
System.out.println("请输入新的菜品单价:");double newprice =sc.nextDouble();
Dishes t= newDishes(dish.getdID(), dish.getDname(), dish.getDtype(), dish.getDtime(), newprice,
dish.getDsales(), dish.getDstocks());
d.insert(t);
System.out.println("修改成功" +d.findById(t.getdID()));
}
}/*** 删除指定id的菜品
*
*@paramargs*/
public voiddeleteDishes() {
System.out.println("请输入您要删除的菜品id");
String id=sc.next();
d.delete(id);
System.out.println("删除成功!!");
}/*** 添加客户*/
public voidaddUser() {
System.out.println("请输入您要添加的用户:按照(id/姓名/性别/密码/送餐地址/手机号)");
String str=sc.next();
String[] info= str.split("/");if (info.length < 6) {
System.out.println("您输入的信息有误,请重新输入....");
addUser();
}else{
LocalDateTime utime=LocalDateTime.now();
u.insert(new User(info[0], info[1], info[2], info[3], info[4], info[5], utime));
System.out.println("添加成功");
}
}/*** 查看客户列表*/
public voidfindUser() {
List userlist =u.findAll();for(User user : userlist) {
System.out.println(user);
}
}/*** 根据id查找指定用户*/
publicUser findUserByid(String id) {returnu.findById(id);
}/*** 删除指定id的客户*/
public voiddeleteUserByAdmin() {
System.out.println("请输入您要删除的id:");
String id=sc.next();
u.delete(id);
}/*** 订单列表显示*/
public voidshowAllOrder() {
List allOrder =o.findAll();for(Order order : allOrder) {
System.out.println(order);
}
}/*** 根据订单id修改订单状态*/
public voidchangeOrderValue() {
System.out.println("请输入您要修改状态的订单id");
String id=sc.next();
Order order=o.findById(id);if (order == null) {
System.out.println("没有当前id的订单,请检查输入");
}else{
System.out.println("已找到当前id订单" +order);
System.out.println("请输入您要修改的状态:0:未支付 1:已支付 2:配送中 3:已完成");int value =sc.nextInt();
Order t= newOrder(order.getOrderID(), order.getUtime(), order.getDishes(), order.getOrdernum(),
order.getuID(), order.getOrderprice(), value);
o.insert(t);
System.out.println("修改成功了!!!");
}
}/*** 显示所有菜品(按菜品销量从高到低排序输出)*/
public voidshowAllDishesByUser() {
List list =d.findAll();
Collections.sort(list, (p1, p2)-> p1.getDsales() -p2.getDsales());
System.out.println(list);
}/*** 点餐(输入菜品id和购买数量)*/
public voidshopDishes(User user) {
showAllDishesByUser();
System.out.println("请输入您要购买的id和数量:按照(id/数量)");
String str=sc.next();
String[] info= str.split("/");//判断输入是否符合要求,不符合则要求重新输入
if (info.length < 2) {
System.out.println("输入有误,请重新输入:");
shopDishes(user);
}else{
LocalDateTime l=LocalDateTime.now();//String orderID, LocalDateTime utime, Dishes dishes, int ordernum, String uID,//Double orderprice,int orderValue
Order t = new Order(info[0], l, d.findById(info[0]), Integer.parseInt(info[1]), user.getuID(),
o.findById(info[0]).getOrderprice(), o.findById(info[0]).getOrderValue());
o.insert(t);
System.out.println("订单已生成!!!" + o.findById(info[0]));
}
}/*** 根据菜品类别显示所有菜品*/
public voidShowOfTypeByUser() {
System.out.println("请输入您要查找的类别:");
String str=sc.next();
System.out.println(d.findByType(str));
}/*** 查看所有订单(当前登录用户的)*/
public voidshowAllOrderByUser(User user) {
List list =o.findByuId(user.getuID());for(Order order : list) {
System.out.println(order);
}
}/*** 修改密码(当前登录用户的)*/
public voidchangePwdByUser(User user) {
u.changepwd(user.getuID());
System.out.println("修改成功!!");
}/*** 个人信息显示*/
public voidshowByUser(User user) {
User findById=u.findById(user.getuID());
System.out.println(findById);
}//待补充功能,删除管理员
@Overridepublic voiddelete(String id) {
}//待补充功能,添加管理员
@Overridepublic voidinsert(Admin t) {//TODO Auto-generated method stub
}//待补充功能,通过id即账号查找管理员
@OverridepublicAdmin findById(String id) {returnmap.get(id);
}//待补充功能,显示所有管理员
@Overridepublic ListfindAll() {//TODO Auto-generated method stub
return null;
}//先设置系统默认数据
public voidaddMessage() {
map.put("qwl", new Admin("10086", "qwl", "123456"));
LocalDate time=LocalDate.now();
Dishes d1= new Dishes("1", "红烧猪蹄", "肉类", time, 12.5, 20, 30);
d.insert(d1);
Dishes d2= new Dishes("2", "鸡公煲", "肉类", time, 21.5, 30, 20);
d.insert(d2);
Dishes d3= new Dishes("3", "麻辣香锅", "火锅类", time, 30, 5, 10);
d.insert(d3);
Dishes d4= new Dishes("4", "水煮肉片", "肉类", time, 15, 12, 15);
d.insert(d4);
Dishes d5= new Dishes("5", "水果沙拉", "水果类", time, 6, 70, 60);
d.insert(d5);//String orderID, LocalDateTime utime, Dishes dishes, int ordernum, String uID,//Double orderprice,int orderValue
LocalDateTime localdatetime =LocalDateTime.now();
Order o1= new Order("1", localdatetime, d1, 10, "1001", 60.0, 1);
o.insert(o1);
Order o2= new Order("2", localdatetime, d2, 5, "1002", 50.0, 10);
o.insert(o2);
Order o3= new Order("3", localdatetime, d3, 5, "1003", 40.0, 5);
o.insert(o3);
Order o4= new Order("4", localdatetime, d4, 5, "1004", 30.0, 6);
o.insert(o4);
Order o5= new Order("5", localdatetime, d5, 5, "1005", 20.0, 8);
o.insert(o5);//String uID, String uname, String usex, String upwd, String uadress, String//utel, LocalDateTime utime
User u1 = new User("1001", "张三", "男", "123456", "湖北", "13545286487", localdatetime);
u.insert(u1);
User u2= new User("1002", "李四", "男", "234567", "湖南", "15927948976", localdatetime);
u.insert(u2);
User u3= new User("1003", "王五", "男", "345678", "江苏", "15927986854", localdatetime);
u.insert(u3);
User u4= new User("1004", "刘柳", "女", "456789", "浙江", "18771580860", localdatetime);
u.insert(u4);
User u5= new User("1005", "赵琦", "女", "567890", "新疆", "18771580750", localdatetime);
u.insert(u5);
}
}
2. Order属性管理类
packagecom.softeem.lesson23.test2;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;importjava.util.Objects;importjava.util.Set;public class OrderSys implements DAO{static Map ordermap = new HashMap<>();static List orderlist = new ArrayList<>();/*** 新增订单*/@Overridepublic voidinsert(Order t) {
ordermap.put(t.getOrderID(), t);
}/*** 通过订单id查找订单*/@OverridepublicOrder findById(String id) {if (ordermap.get(id) == null) {return null;
}else{returnordermap.get(id);
}
}/*** 通过用户id查询用户的所有订单,并返回一个list集合
*@paramuid
*@return
*/
public ListfindByuId(String uid) {
List list = new ArrayList<>();
Set keys =ordermap.keySet();for(String key : keys) {if(Objects.equals(uid, ordermap.get(key).getuID())) {
list.add(ordermap.get(key));
}
}returnlist;
}/*** 显示所有订单*/@Overridepublic ListfindAll() {
Set keys =ordermap.keySet();for(String key : keys) {
orderlist.add(ordermap.get(key));
}returnorderlist;
}/*** 待完成功能,删除订单*/@Overridepublic voiddelete(String id) {//TODO Auto-generated method stub
}
}
3. User属性管理类
packagecom.softeem.lesson23.test2;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;importjava.util.Scanner;importjava.util.Set;//客户id,客户名,性别,密码,送餐地址,手机号,创建时间
public class UserSys implements DAO{static Map usermap = new HashMap<>();
List list = new ArrayList<>();
Scanner sc= newScanner(System.in);/*** 添加客户*/@Overridepublic voidinsert(User t) {
usermap.put(t.getuID(), t);
}/*** 查看客户列表*/@Overridepublic ListfindAll() {
Set keys =usermap.keySet();for(String str : keys) {
list.add(usermap.get(str));
}returnlist;
}/*** 删除指定id的客户*/@Overridepublic voiddelete(String id) {if (usermap.get(id) == null) {
System.out.println("没有当前id的客户");
}else{
System.out.println(usermap.get(id)+ "已删除!!!");
usermap.remove(id);
}
}/*** 修改密码(当前登录用户的)*/
public voidchangepwd(String id) {
User user=findById(id);
System.out.println("请输入新密码:");
String str=sc.next();
User t= newUser(user.getuID(), user.getUname(), user.getUsex(), str, user.getUadress(), user.getUtel(),
user.getUtime());
usermap.put(id, t);
}/*** 通过id查找对应客户*/@OverridepublicUser findById(String id) {if (usermap.get(id) == null) {return null;
}else{returnusermap.get(id);
}
}
}
4. Dishes属性管理类
packagecom.softeem.lesson23.test2;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;importjava.util.Objects;importjava.util.Set;public class DishesSys implements DAO{//建立一个菜品的map集合,其中菜品的id为map的键,整个菜品对象为map的值
static Map dishesmap = new HashMap<>();
Set keys =dishesmap.keySet();/*** 添加菜品*/@Overridepublic voidinsert(Dishes t) {
dishesmap.put(t.getdID(), t);
}/*** 通过id来寻找菜品*/@OverridepublicDishes findById(String id) {if (dishesmap.get(id) == null) {return null;
}else{returndishesmap.get(id);
}
}/*** 根据菜品类型查找菜品*/
public ListfindByType(String type) {
List list = new ArrayList<>();for(String key : keys) {if(Objects.equals(type, dishesmap.get(key).getDtype())) {
list.add(dishesmap.get(key));
}
}returnlist;
}/*** 查询所有菜品*/@Overridepublic ListfindAll() {
List list = new ArrayList<>();for(String str : keys) {
list.add(dishesmap.get(str));
}returnlist;
}public voidselectBytype(String typename) {int count = 0;for(String key : keys) {if(Objects.equals(dishesmap.get(key).getDtype(), typename)) {
System.out.println(dishesmap.get(key));
count++;
}
}if (count == 0) {
System.out.println("没有当前类别的菜品!");
}
}/*** 删除指定id菜品*/@Overridepublic voiddelete(String id) {if (dishesmap.get(id) == null) {
System.out.println("输入id错误...");
}else{
dishesmap.remove(id);
}
}
}
以上基本就是代码的核心部分,剩下的部分就简化很多了,建立一个菜单类,分别对其进行不同调用就行了
三、菜单类
packagecom.softeem.lesson23.test2;importjava.util.Objects;importjava.util.Scanner;public classMenu {static AdminSys admin = newAdminSys();
Scanner sc= newScanner(System.in);public voidshowMenu() {
admin.addMessage();
System.out.println("请输入账号和密码:按照(账号/密码)");
String str=sc.next();
String[] info= str.split("/");if (info.length < 2) {
System.out.println("输入有误,请重新输入:");
showMenu();
}else{if (admin.findById(info[0]) != null && Objects.equals(admin.findById(info[0]).getApwd(), info[1])) {
adminMenu();
}else if (admin.findUserByid(info[0]) != null
&& Objects.equals(info[1], admin.findUserByid(info[0]).getUpwd())) {
User user= admin.findUserByid(info[0]);
userMenu(user);
}else{
System.out.println("输入有误,请重新输入....");
showMenu();
}
}
}public voiduserMenu(User user) {
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("请输入您要进行的操作:");
String n=sc.next();switch(n) {case "1":
admin.shopDishes(user);
userMenu(user);break;case "2":
admin.ShowOfTypeByUser();
userMenu(user);break;case "3":
admin.showAllOrderByUser(user);
userMenu(user);break;case "4":
admin.changePwdByUser(user);
userMenu(user);break;case "5":
admin.showByUser(user);
userMenu(user);break;case "6":
System.out.println("谢谢使用,再见!");
System.exit(0);default:
System.out.println("输入错误,请重新输入:");
userMenu(user);
}
}public voidadminMenu() {
System.out.println("=========欢迎您尊贵的管理员=======");
System.out.println("====【1】添加菜品===============");
System.out.println("====【2】查看所有菜品信息显示=======");
System.out.println("====【3】查看指定类别的菜品信息=====");
System.out.println("====【4】根据菜品id修改菜品价格=====");
System.out.println("====【5】删除指定id的菜品=========");
System.out.println("====【6】添加客户================");
System.out.println("====【7】查看客户列表=============");
System.out.println("====【8】删除指定id的用户==========");
System.out.println("====【9】订单列表显示=============");
System.out.println("====【10】根据订单id修改订单状态====");
System.out.println("====【11】退出=================");
String m=sc.next();switch(m) {case "1":
admin.addDishes();
adminMenu();break;case "2":
System.out.println("请输入您需要每行显示多少数据:");int pageSize =sc.nextInt();
admin.showAllDishes(pageSize);
adminMenu();break;case "3":
admin.selecBytypeOfAdmin();
adminMenu();break;case "4":
admin.selectByDishesID();
adminMenu();break;case "5":
admin.deleteDishes();
adminMenu();break;case "6":
admin.addUser();
adminMenu();break;case "7":
admin.findUser();
adminMenu();break;case "8":
admin.deleteUserByAdmin();
adminMenu();break;case "9":
admin.showAllOrder();
adminMenu();break;case "10":
admin.changeOrderValue();
adminMenu();break;case "11":
System.out.println("谢谢使用,再见!");
System.exit(0);break;default:
System.out.println("输入错误,请重新输入:");
adminMenu();
}
}
}
这里switch采取String(jdk1.7以后才支持)可以让用户就算输入错误也不会报错导致程序运行终止,又要重新输入(我摊牌了,就是懒)。
四、测试类
packagecom.softeem.lesson23.test2;public classTest {public static voidmain(String[] args) {
Menu m= newMenu();
m.showMenu();
}
}
五、实现部分界面截图
以上就是全部代码。
有完整的Java初级,高级对应的学习路线和资料!专注于java开发。分享java基础、原理性知识、JavaWeb实战、spring全家桶、设计模式、分布式及面试资料、开源项目,助力开发者成长!
欢迎关注微信公众号:码邦主