Beispiel #1
0
 public void PrintHotelType(HotelType type)
 {
     if (type.Equals(HotelType.BRIDGEWOOD))
     {
         Console.WriteLine("BridgeWood");
     }
     else if (type.Equals(HotelType.RIDGEWOOD))
     {
         Console.WriteLine("RidgeWood");
     }
     else
     {
         Console.WriteLine("LakeWood");
     }
 }
 public Hotel(HotelType hotelType)
 {
     this.type = hotelType;
     try
     {
         if (hotelType.Equals(HotelType.LAKEWOOD))
         {
             this.RATE = 110;
         }
         if (hotelType.Equals(HotelType.BRIDGEWOOD))
         {
             this.RATE = 150;
         }
         if (hotelType.Equals(HotelType.RIDGEWOOD))
         {
             this.RATE = 220;
         }
     }
     catch (HotelReservationException)
     {
         throw new HotelReservationException(HotelReservationException.ExceptionType.INVALID_HOTEL_TYPE, "Invalid Hotel Type");
     }
 }
Beispiel #3
0
 public Hotel(HotelType hotelType, CustomerType customerType)
 {
     this.type = hotelType;
     try
     {
         if (hotelType.Equals(HotelType.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 (HotelReservationException)
             {
                 throw new HotelReservationException(HotelReservationException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
         if (hotelType.Equals(HotelType.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 (HotelReservationException)
             {
                 throw new HotelReservationException(HotelReservationException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
         if (hotelType.Equals(HotelType.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 HotelReservationException(HotelReservationException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid customer type");
             }
         }
     }
     catch (HotelReservationException)
     {
         throw new HotelReservationException(HotelReservationException.ExceptionType.INVALID_HOTEL_TYPE, "Invalid Hotel Type");
     }
 }