Exemple #1
0
 public Hotel(HotelTypes hotelType, CustomerType customerType)
 {
     this.type = hotelType;
     try
     {
         if (hotelType.Equals(HotelTypes.LAKEWOOD))
         {
             this.RATING = 3;
             try
             {
                 if (customerType.Equals(CustomerType.NORMAL))
                 {
                     this.WEEKDAY_RATE = 110;
                     this.WEEKEND_RATE = 90;
                 }
                 if (customerType.Equals(CustomerType.REWARD))
                 {
                     this.WEEKDAY_RATE = 80;
                     this.WEEKEND_RATE = 80;
                 }
             }
             catch (HotelReservationSystemException)
             {
                 throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
         if (hotelType.Equals(HotelTypes.BRIDGEWOOD))
         {
             this.RATING = 4;
             try
             {
                 if (customerType.Equals(CustomerType.NORMAL))
                 {
                     this.WEEKDAY_RATE = 150;
                     this.WEEKEND_RATE = 50;
                 }
                 if (customerType.Equals(CustomerType.REWARD))
                 {
                     this.WEEKDAY_RATE = 110;
                     this.WEEKEND_RATE = 50;
                 }
             }
             catch (HotelReservationSystemException)
             {
                 throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
         if (hotelType.Equals(HotelTypes.RIDGEWOOD))
         {
             this.RATING = 5;
             try
             {
                 if (customerType.Equals(CustomerType.NORMAL))
                 {
                     this.WEEKDAY_RATE = 220;
                     this.WEEKEND_RATE = 150;
                 }
                 if (customerType.Equals(CustomerType.REWARD))
                 {
                     this.WEEKDAY_RATE = 100;
                     this.WEEKEND_RATE = 40;
                 }
             }
             catch (Exception)
             {
                 throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
     }
     catch (HotelReservationSystemException)
     {
         throw new HotelReservationSystemException(HotelReservationSystemException.ExceptionType.INVALID_HOTEL_TYPE, "Invalid Hotel Type");
     }
 }