赞
踩
目录
src
package dao; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.BeanHandler; import org.apache.commons.dbutils.handlers.BeanListHandler; import org.apache.commons.dbutils.handlers.ScalarHandler; import utils.JDBCUtilsByDruid; import java.sql.Connection; import java.sql.SQLException; import java.util.List; /** *@author fengwj *@version 1.0 * BasicDAO的使用 */ @SuppressWarnings({"all"}) public class BasicDAO<T> { //指定具体类型 private QueryRunner qr=new QueryRunner(); public int update(String sql,Object...parameters){ /** * @Description 通用的dml方法,针对任意的表 * @param sql sql语句 * @param parameters 参数 * @return: int */ Connection connection=null; try { connection= JDBCUtilsByDruid.getConnection(); int update=qr.update(connection,sql,parameters); return update; } catch (SQLException e) { throw new RuntimeException(e); } finally { JDBCUtilsByDruid.close(null,null,connection); } } public List<T> queryMulti(String sql, Class<T>clazz,Object...parameters){ /** * @Description 返回多个对象(查询多条结果) * @param sql 语句 * @param parameters 参数 * @param clazz 类的Class对象 * @return: java.util.List<T> */ Connection connection=null; try { connection= JDBCUtilsByDruid.getConnection(); return qr.query(connection,sql,new BeanListHandler<T>(clazz),parameters); } catch (SQLException e) { throw new RuntimeException(e); } finally { JDBCUtilsByDruid.close(null,null,connection); } } public T querySingle(String sql,Class<T>clazz,Object...parameters){ /** * @Description 返回单行查询结果 * @param sql * @param clazz * @param parameters * @return: T */ Connection connection=null; try { connection= JDBCUtilsByDruid.getConnection(); return qr.query(connection,sql, new BeanHandler<T>(clazz),parameters); } catch (SQLException e) { throw new RuntimeException(e); } finally { JDBCUtilsByDruid.close(null,null,connection); } } public Object queryScalar(String sql,Object...parameters){ /** * @Description 返回单行单列 * @param sql * @param parameters * @return: java.lang.Object */ Connection connection=null; try { connection= JDBCUtilsByDruid.getConnection(); return qr.query(connection,sql, new ScalarHandler<>(),parameters); } catch (SQLException e) { throw new RuntimeException(e); } finally { JDBCUtilsByDruid.close(null,null,connection); } } }
package dao;
import domain.Bill;
public class BillDAO<M> extends BasicDAO<Bill>{
}
package dao;
import domain.DinningTable;
public class DinningTableDAO extends BasicDAO<DinningTable> {
}
package dao;
import domain.Employee;
public class EmployeeDAO extends BasicDAO<Employee>{
}
package dao;
import domain.Menu;
public class MenuDAO extends BasicDAO<Menu>{
}
package dao;
import domain.MultiTableBean;
public class MultiTableDAO extends BasicDAO<MultiTableBean>{
}
package domain; import java.util.Date; /** *@author fengwj *@version 1.0 * bill * create table bill( * id int PRIMARY key auto_increment, * billId VARCHAR(50) not null DEFAULT '', # 订单号 * menuId int not null DEFAULT 0, # 菜品编号 * nums int not null DEFAULT 0, # 菜品数量 * money double not null DEFAULT 0, # 金额 * dinningTableId int not null DEFAULT 0, #餐桌编号 * billDate datetime not null, * state VARCHAR(50) not null DEFAULT '' #支付状态 * ) */ public class Bill { private Integer id; private String billId; private Integer menuId; private Integer nums; private Double money; private Integer dinningTableId; private Date billDate; private String state; public Bill() {} public Bill(Integer id, String billId, Integer menuId, Integer nums, Double money, Integer dinningTableId, Date billDate, String state) { this.id = id; this.billId = billId; this.menuId = menuId; this.nums = nums; this.money = money; this.dinningTableId = dinningTableId; this.billDate = billDate; this.state = state; } @Override public String toString() { return id+ "\t\t" + menuId + "\t\t\t" + nums + "\t\t\t" + money + "\t" + dinningTableId + "\t\t" + billDate + "\t\t"+ state; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getBillId() { return billId; } public void setBillId(String billId) { this.billId = billId; } public Integer getMenuId() { return menuId; } public void setMenuId(Integer menuId) { this.menuId = menuId; } public Integer getNums() { return nums; } public void setNums(Integer nums) { this.nums = nums; } public Double getMoney() { return money; } public void setMoney(Double money) { this.money = money; } public Integer getDinningTableId() { return dinningTableId; } public void setDinningTableId(Integer dinningTableId) { this.dinningTableId = dinningTableId; } public Date getBillDate() { return billDate; } public void setBillDate(Date billDate) { this.billDate = billDate; } public String getState() { return state; } public void setState(String state) { this.state = state; } }
package domain; /** *@author fengwj *@version 1.0 * 与表dinningTable对应 */ public class DinningTable { private Integer id; private String state; private String orderName; private String orderTel; //反射需要无参构造器!!!! public DinningTable(){} public DinningTable(Integer id, String state, String orderName, String orderTel) { this.id = id; this.state = state; this.orderName = orderName; this.orderTel = orderTel; } @Override public String toString() { return id+"\t\t\t"+state; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getOrderName() { return orderName; } public void setOrderName(String orderName) { this.orderName = orderName; } public String getOrderTel() { return orderTel; } public void setOrderTel(String orderTel) { this.orderTel = orderTel; } }
package domain; /** *@author fengwj *@version 1.0 * 映射employee表 */ public class Employee { private Integer id; private String empId; private String pwd; private String name; private String job; public Employee(){} public Employee(Integer id, String empId, String pwd, String name, String job) { this.id = id; this.empId = empId; this.pwd = pwd; this.name = name; this.job = job; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getEmpId() { return empId; } public void setEmpId(String empId) { this.empId = empId; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } }
package domain; /** *@author fengwj *@version 1.0 * 与菜单menu对应的javabean * create table menu( * id int PRIMARY key auto_increment, * name VARCHAR(30) not null DEFAULT '', # 菜品名称 * type VARCHAR(30) not null DEFAULT '', # 菜品种类 * price double not null DEFAULT 0 # 菜品价格 * ) */ public class Menu { private Integer id; private String name; private String type; private Double price; public Menu() {} public Menu(Integer id, String name, String type, Double price) { this.id = id; this.name = name; this.type = type; this.price = price; } @Override public String toString() { return id+"\t\t\t"+name+"\t\t\t"+type+"\t\t\t"+price; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } }
package domain; import java.util.Date; /** *@author fengwj *@version 1.0 * 多表查询的javabean映射多表 */ public class MultiTableBean { private Integer id; private String billId; private Integer menuId; private Integer nums; private Double money; private Integer dinningTableId; private Date billDate; private String state; private String name; private Double price; public MultiTableBean() {} public MultiTableBean(Integer id, String billId, Integer menuId, Integer nums, Double money, Integer dinningTableId, Date billDate, String state, String name,Double price) { this.id = id; this.billId = billId; this.menuId = menuId; this.nums = nums; this.money = money; this.dinningTableId = dinningTableId; this.billDate = billDate; this.state = state; this.name = name; this.price=price; } @Override public String toString() { return id+ "\t\t" + menuId + "\t\t\t" + nums + "\t\t\t" + money + "\t" + dinningTableId + "\t\t" + billDate + "\t\t"+ state+ "\t\t"+ name+ "\t\t"+price; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getBillId() { return billId; } public void setBillId(String billId) { this.billId = billId; } public Integer getMenuId() { return menuId; } public void setMenuId(Integer menuId) { this.menuId = menuId; } public Integer getNums() { return nums; } public void setNums(Integer nums) { this.nums = nums; } public Double getMoney() { return money; } public void setMoney(Double money) { this.money = money; } public Integer getDinningTableId() { return dinningTableId; } public void setDinningTableId(Integer dinningTableId) { this.dinningTableId = dinningTableId; } public Date getBillDate() { return billDate; } public void setBillDate(Date billDate) { this.billDate = billDate; } public String getState() { return state; } public void setState(String state) { this.state = state; } }
package service; import dao.BillDAO; import dao.MultiTableDAO; import domain.Bill; import domain.MultiTableBean; import java.util.List; import java.util.UUID; /** *@author fengwj *@version 1.0 * 账单业务 */ public class BillService { //得到dao对象 private BillDAO billDAO=new BillDAO(); private MultiTableDAO multiTableDAO=new MultiTableDAO(); //MenuService对象 private MenuService menuService=new MenuService(); //dinningService对象 private DinningTableService dinningTableService=new DinningTableService(); public boolean orderMenu(int menuId,int nums,int dinningTableId){ /** * @Description 生成账单,更新餐桌状态 * @param menuId 菜品编号 * @param nums 菜品数量 * @param dinningTableId 餐桌编号 * @return: boolean */ //生成账单 String billID= UUID.randomUUID().toString(); int update = billDAO.update("insert into bill values(null,?,?,?,?,?,now(),'未结账')", billID, menuId, nums, menuService.getMenuById(menuId).getPrice() * nums, dinningTableId); if(update<=0) return false; //更新餐桌状态 return dinningTableService.updateDinningTableState(dinningTableId,"就餐中"); } public List<Bill> list(){ /** * @Description 返回所有的账单 * @param * @return: java.util.List<domain.Bill> */ return billDAO.queryMulti("select * from bill",Bill.class); } public List<MultiTableBean>listMultiTable(){ /** * @Description 多表查询 * @param * @return: java.util.List<domain.MultiTableBean> */ return multiTableDAO.queryMulti("select bill.*,name,price " + "from bill,menu "+ "where bill.menuId=menu.id",MultiTableBean.class); } public boolean hasPayBillByDinningTableId(int dinningTableId){ /** * @Description 通过id查找是否支付账单 * @param dinningTableId * @return: boolean */ Bill bill = (Bill) billDAO.querySingle("select *from bill where dinningTableId=? and state='未结账'limit 0,1", Bill.class, dinningTableId); return bill!=null; } public boolean payBill(int dinningTableId,String payMod){ /** * @Description 支付账单,同时修改bill和table表的状态 * @param dinningTableId * @param payMod 支付方式 * @return: boolean */ //修改bill int update = billDAO.update("update bill set state=? where dinningTableId=? and state='未结账'", payMod, dinningTableId); if(update<=0){ return false; } //修改table if(!dinningTableService.updateDinningTableToFree(dinningTableId,"空")){ return false; } return true; } }
package service; import dao.DinningTableDAO; import domain.DinningTable; import java.util.List; /** *@author fengwj *@version 1.0 * 返回餐桌状态 */ public class DinningTableService { private DinningTableDAO dinningTableDAO=new DinningTableDAO(); public List<DinningTable> list(){ /** * @Description 返回餐桌集合 * @param * @return: java.util.List<domain.DinningTable> */ return dinningTableDAO.queryMulti("select id,state from dinningTable",DinningTable.class); } public DinningTable getDinningTableById(int id){ /** * @Description 通过id返回要预定的餐桌,不存在返回null * @param id * @return: domain.DinningTable */ return dinningTableDAO.querySingle("select *from dinningTable where id=?", DinningTable.class,id); } public boolean orderDinningTable(int id,String orderName,String orderTel){ /** * @Description 如果餐桌可以预定,则通过传参更改餐桌信息 * @param id * @param orderName * @param orderTel * @return: boolean */ int update = dinningTableDAO.update("update dinningTable set state='已预定',orderName=?,orderTel=? where id=?", orderName, orderTel,id); return update>0; } public boolean updateDinningTableState(int id,String state){ /** * @Description 根据id更新对应的餐桌状态 * @param id * @param state * @return: boolean */ int update=dinningTableDAO.update("update dinningTable set state=? where id=?",state,id); return update>0; } public boolean updateDinningTableToFree(int id,String state){ /** * @Description 根据id将餐桌置空 * @param id * @param state * @return: boolean */ int update=dinningTableDAO.update("update dinningTable set state=?,orderName='',orderTel='' where id=?",state,id); return update>0; } }
package service; import dao.EmployeeDAO; import domain.Employee; /** *@author fengwj *@version 1.0 * 通过调用DAO完成对表的操作 */ public class EmployService { private EmployeeDAO employeeDAO=new EmployeeDAO(); public Employee getEmployeeByIdAndPwd(String empId,String pwd){ /** * @Description 通过用户名和密码返回一个员工对象 * @param empId * @param pwd * @return: domain.Employee */ Employee employee = employeeDAO.querySingle("select * from employee where empId=? and pwd=md5(?)", Employee.class, empId, pwd); return employee; } }
package service; import dao.MenuDAO; import domain.Menu; import java.util.List; /** *@author fengwj *@version 1.0 * 操作menu */ public class MenuService { private MenuDAO menuDAO=new MenuDAO(); public List<Menu>list(){ /** * @Description 返回所有菜品 * @param * @return: java.util.List<domain.Menu> */ return menuDAO.queryMulti("select *from menu",Menu.class); } public Menu getMenuById(int id){ /** * @Description 根据id获取菜品对象 * @param id * @return: domain.Menu */ return menuDAO.querySingle("select *from menu where id=?", Menu.class,id); } }
package utils; import com.alibaba.druid.pool.DruidDataSourceFactory; import javax.sql.DataSource; import java.io.FileInputStream; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; /** *@author fengwj *@version 1.0 * 基于druid数据库连接池的工具类 */ public class JDBCUtilsByDruid { private static DataSource ds; //初始化 static { try { Properties properties = new Properties(); properties.load(new FileInputStream("src\\druid.properties")); ds= DruidDataSourceFactory.createDataSource(properties); } catch (Exception e) { throw new RuntimeException(e); } } //连接方法 public static Connection getConnection() throws SQLException { return ds.getConnection(); } //关闭连接,将Connection对象放回连接池 public static void close(ResultSet set, Statement statement, Connection connection){ try { if(set!=null){ set.close(); } if(statement!=null){ statement.close(); } if(connection!=null){ connection.close(); } } catch (SQLException e) { throw new RuntimeException(e); } } }
package utils; import java.util.Scanner; public class Utility { /** 工具类的作用: 处理各种情况的用户输入,并且能够按照程序员的需求,得到用户的控制台输入。 */ private static Scanner scanner = new Scanner(System.in); /** * 功能:读取键盘输入的一个菜单选项,值:1——5的范围 * @return 1——5 */ public static char readMenuSelection() { char c; for (; ; ) { String str = readKeyBoard(1, false);//包含一个字符的字符串 c = str.charAt(0);//将字符串转换成字符char类型 if (c != '1' && c != '2' && c != '3' && c != '4' && c != '5') { System.out.print("选择错误,请重新输入:"); } else break; } return c; } /** * 功能:读取键盘输入的一个字符 * @return 一个字符 */ public static char readChar() { String str = readKeyBoard(1, false);//就是一个字符 return str.charAt(0); } /** * 功能:读取键盘输入的一个字符,如果直接按回车,则返回指定的默认值;否则返回输入的那个字符 * @param defaultValue 指定的默认值 * @return 默认值或输入的字符 */ public static char readChar(char defaultValue) { String str = readKeyBoard(1, true);//要么是空字符串,要么是一个字符 return (str.length() == 0) ? defaultValue : str.charAt(0); } /** * 功能:读取键盘输入的整型,长度小于2位 * @return 整数 */ public static int readInt() { int n; for (; ; ) { String str = readKeyBoard(10, false);//一个整数,长度<=10位 try { n = Integer.parseInt(str);//将字符串转换成整数 break; } catch (NumberFormatException e) { System.out.print("数字输入错误,请重新输入:"); } } return n; } /** * 功能:读取键盘输入的 整数或默认值,如果直接回车,则返回默认值,否则返回输入的整数 * @param defaultValue 指定的默认值 * @return 整数或默认值 */ public static int readInt(int defaultValue) { int n; for (; ; ) { String str = readKeyBoard(10, true); if (str.equals("")) { return defaultValue; } //异常处理... try { n = Integer.parseInt(str); break; } catch (NumberFormatException e) { System.out.print("数字输入错误,请重新输入:"); } } return n; } /** * 功能:读取键盘输入的指定长度的字符串 * @param limit 限制的长度 * @return 指定长度的字符串 */ public static String readString(int limit) { return readKeyBoard(limit, false); } /** * 功能:读取键盘输入的指定长度的字符串或默认值,如果直接回车,返回默认值,否则返回字符串 * @param limit 限制的长度 * @param defaultValue 指定的默认值 * @return 指定长度的字符串 */ public static String readString(int limit, String defaultValue) { String str = readKeyBoard(limit, true); return str.equals("")? defaultValue : str; } /** * 功能:读取键盘输入的确认选项,Y或N * 将小的功能,封装到一个方法中. * @return Y或N */ public static char readConfirmSelection() { System.out.println("请输入你的选择(Y/N): 请小心选择"); char c; for (; ; ) {//无限循环 //在这里,将接受到字符,转成了大写字母 //y => Y n=>N String str = readKeyBoard(1, false).toUpperCase(); c = str.charAt(0); if (c == 'Y' || c == 'N') { break; } else { System.out.print("选择错误,请重新输入:"); } } return c; } /** * 功能: 读取一个字符串 * @param limit 读取的长度 * @param blankReturn 如果为true ,表示 可以读空字符串。 * 如果为false表示 不能读空字符串。 * * 如果输入为空,或者输入大于limit的长度,就会提示重新输入。 * @return */ private static String readKeyBoard(int limit, boolean blankReturn) { //定义了字符串 String line = ""; //scanner.hasNextLine() 判断有没有下一行 while (scanner.hasNextLine()) { line = scanner.nextLine();//读取这一行 //如果line.length=0, 即用户没有输入任何内容,直接回车 if (line.length() == 0) { if (blankReturn) return line;//如果blankReturn=true,可以返回空串 else continue; //如果blankReturn=false,不接受空串,必须输入内容 } //如果用户输入的内容大于了 limit,就提示重写输入 //如果用户如的内容 >0 <= limit ,我就接受 if (line.length() < 1 || line.length() > limit) { System.out.print("输入长度(不能大于" + limit + ")错误,请重新输入:"); continue; } break; } return line; } }
package view; import domain.*; import service.BillService; import service.DinningTableService; import service.EmployService; import service.MenuService; import utils.Utility; import java.util.List; /** *@author fengwj *@version 1.01 * 菜单 */ public class MHLView { //接受输入 private String key=""; private boolean loop=true; //员工信息对象 private EmployService employService=new EmployService(); //餐桌状态对象 private DinningTableService dinningTableService=new DinningTableService(); //显示菜品对象 private MenuService menuService=new MenuService(); //点餐对象 private BillService billService=new BillService(); public static void main(String[] args) { new MHLView().mainMenu(); } //显示餐桌状态 public void listDinningTable(){ List<DinningTable> list = dinningTableService.list(); System.out.println("\n餐桌编号\t\t餐桌状态"); for(DinningTable dinningTable :list){ System.out.println(dinningTable); } System.out.println("========显示结束======="); } //完成订座 public void orderTable(){ System.out.println("========预定餐桌======="); System.out.print("输入预定餐桌的编号(-1退出):"); int orderId = Utility.readInt(); if(orderId==-1){ System.out.println("========取消预定餐桌======="); return; } char key = Utility.readConfirmSelection(); if(key=='Y'){ DinningTable dinningTableById = dinningTableService.getDinningTableById(orderId); if(dinningTableById==null){ System.out.println("========餐桌不存在======="); }else{ //餐桌存在且没有被预定 if(!dinningTableById.getState().equals("空")){ System.out.println("========餐桌已被预定======="); }else{ //读取预定信息 System.out.print("输入预定人姓名:"); String orderName = Utility.readString(50); System.out.print("输入预定人电话:"); String orderTel = Utility.readString(60); //更新餐桌信息 if(dinningTableService.orderDinningTable(orderId, orderName, orderTel)){ System.out.println("========预定成功======="); }else{ System.out.println("========预定失败======="); } } } }else{ System.out.println("========退出预定======="); } } //显示菜品 public void listMenu(){ List<Menu> list = menuService.list(); System.out.println("\n菜品编号\t\t菜品名\t\t类别\t\t价格"); for(Menu menu:list){ System.out.println(menu); } System.out.println("========菜品显示完毕======="); } //点餐 public void orderMenu(){ System.out.println("========点餐服务======="); System.out.print("请输入餐桌编号(-1退出):"); int orderTable = Utility.readInt(); if(orderTable==-1){ System.out.println("========取消点餐======="); return; } System.out.print("请输入菜品编号(-1退出):"); int orderMenu = Utility.readInt(); if(orderMenu==-1){ System.out.println("========取消点餐======="); return; } System.out.print("请输入菜品数量(-1退出):"); int orderNums = Utility.readInt(); if(orderNums==-1){ System.out.println("========取消点餐======="); return; } //验证餐桌是否存在 DinningTable dinningTable = dinningTableService.getDinningTableById(orderTable); if(dinningTable==null){ System.out.println("========餐桌不存在======="); return; } //验证菜品是否存在 Menu menu = menuService.getMenuById(orderMenu); if(menu==null){ System.out.println("========菜品不存在======="); return; } if(billService.orderMenu(orderMenu, orderNums, orderTable)){ System.out.println("========点餐成功======="); }else { System.out.println("========点餐失败======="); } } //显示账单信息 public void listBill(){ List<Bill> bills = billService.list(); System.out.println("\n编号\t\t菜品号\t\t菜品量\t\t金额\t\t桌号\t\t日期\t\t\t\t\t\t\t状态"); for (Bill bill:bills) { System.out.println(bill); } System.out.println("========账单显示完成======="); } //显示账单信息(多表查询--显示菜品名称) public void listMultiBill(){ List<MultiTableBean> multiTableBeans = billService.listMultiTable(); System.out.println("\n编号\t\t菜品号\t\t菜品量\t\t金额\t\t桌号\t\t日期\t\t\t\t\t\t\t状态\t\t菜名\t\t价格"); for (MultiTableBean bill:multiTableBeans) { System.out.println(bill); } System.out.println("========账单显示完成======="); } //结账 public void payBill(){ System.out.println("========结账======="); System.out.print("输入结账的餐桌号(-1退出):"); int dinningTableId = Utility.readInt(); if(dinningTableId==-1){ System.out.println("========取消结账======="); return; } //账单是否存在 if(!billService.hasPayBillByDinningTableId(dinningTableId)){ System.out.println("========无账单======="); return; } //餐桌是否存在 if(dinningTableService.getDinningTableById(dinningTableId)==null){ System.out.println("========餐桌不存在======="); return; } System.out.print("输入支付方式(现金/支付宝/微信):"); String payMode = Utility.readString(20, ""); if("".equals(payMode)){ System.out.println("========取消结账======="); return; } System.out.print("确认结账(y/n):"); char key = Utility.readConfirmSelection(); if(key=='Y'){ if(billService.payBill(dinningTableId,payMode)){ System.out.println("========结账成功======="); } else{ System.out.println("========结账失败======="); } }else{ System.out.println("========取消结账======="); } } public void mainMenu(){ while(loop) { System.out.println("========满汉楼主菜单======="); System.out.println("\t\t1.登录"); System.out.println("\t\t2.退出"); System.out.print("请输入你的选择:"); key = Utility.readString(1); switch (key) { case "1": System.out.print("输入用户名:"); String id=Utility.readString(50); System.out.print("输入密码:"); String pwd= Utility.readString(50); Employee employee = employService.getEmployeeByIdAndPwd(id, pwd); if(employee!=null){ System.out.println("========登录成功["+employee.getName()+"]========"); while(loop){ System.out.println("========二级菜单======="); System.out.println("\t\t1.显示餐桌状态"); System.out.println("\t\t2.预定餐桌"); System.out.println("\t\t3.显示所有菜品"); System.out.println("\t\t4.点餐服务"); System.out.println("\t\t5.查看账单"); System.out.println("\t\t6.结账"); System.out.println("\t\t9.退出满汉楼"); System.out.print("请输入你的选择:"); key=Utility.readString(1); switch (key){ case"1": listDinningTable(); break; case"2": orderTable(); break; case"3": listMenu(); break; case"4": orderMenu(); break; case"5": //listBill(); listMultiBill(); break; case"6": payBill(); break; case"9": loop=false; System.out.println("========退出系统======="); break; default: System.out.println("输入有误"); } } }else{ System.out.println("========登录失败======="); } break; case "2": loop = false; break; default: System.out.println("=====输入有误====="); } } System.out.println("=====已退出系统====="); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。