码迷,mamicode.com
首页 > 其他好文 > 详细

amazon 设计 5 hotel and restaurant reservation system

时间:2014-07-27 11:02:02      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/leetcode/p/3870952.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!