首页 > 代码库 > amazon 设计 5 hotel and restaurant reservation system
amazon 设计 5 hotel and restaurant reservation system
there I write down the restaurant system.
public class TimeSpan { Date date; String start; String end;}public class Table { int tableid; String type; HashMap<Date,HashMap<String,String>> reserved; public boolean isFitToRequest(Request ts){ return false; }}public class Request { String name; String phone_number; TimeSpan ts; Date date; int seats; public boolean isFitToRequest(Table table){ return false; }}public class Restaurant { Rinfo rInfo; TableManager tm;}class Rinfo{ String name; String add; String phoneno;}public class TableManager { HashMap<Integer,Table> map_tablse; ArrayList<Table> tables; ArrayList<Request> waitingList; private int numofTable; private int numberofLarge; private int numberofMedium; private int numberofSmall; public TableManager(){ } public synchronized void reserveResult(Request r){ if(processRequest(r)){ System.out.println("Successed!"); }else{ System.out.println("You are on the waiting list"); } } private boolean processRequest(Request r){ for(Table table : tables){ if(r.isFitToRequest(table)){ update(table,r); return true; } else continue; } return false; } public void update(Table table, Request r){} }
amazon 设计 5 hotel and restaurant reservation system
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。