Example #1
0
        public static void UserInput(HotelSystem hotelSystem)
        {
            try
            {
                Console.WriteLine("...................................");
                Console.WriteLine("Enter customer type :1.REGULAR  2.REWARD");
                Console.WriteLine("...................................");

                int customerChoice = Convert.ToInt32(Console.ReadLine());

                if (customerChoice == 1)
                {
                    hotelSystem.ctype = CustomerType.REGULAR;
                }
                else if (customerChoice == 2)
                {
                    hotelSystem.ctype = CustomerType.REWARD;
                }
                else
                {
                    throw new HotelReservationException(HotelReservationException.ExceptionType.INVALID_CUSTOMER_TYPE, "Invalid Customer Type");
                }

                Console.WriteLine("...................................");
                Console.WriteLine("Enter dates in dd-mm--yyyy format");
                string[] dates = Console.ReadLine().Split(",");
                Console.WriteLine("...................................");
                Console.WriteLine("1.Get Cheapest Hotel\n2.Get Cheapest Best Rated Hotel\n3.Get Best Rated Hotel");
                Console.WriteLine("...................................");

                int choice = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("...................................");

                switch (choice)
                {
                case 1:
                    List <Hotel> cheapestHotels = hotelSystem.GetCheapestHotel(dates);
                    hotelSystem.DisplayHotels(cheapestHotels);
                    break;

                case 2:
                    List <Hotel> cheapestBestRatedHotels = hotelSystem.GetCheapestBestRatedHotel(dates);
                    hotelSystem.DisplayHotels(cheapestBestRatedHotels);
                    break;

                case 3:
                    List <Hotel> bestRatedHotels = hotelSystem.GetBestRatedHotel(dates);
                    hotelSystem.DisplayHotels(bestRatedHotels);
                    break;

                default:
                    Console.WriteLine("Invalid Operation");
                    break;
                }
            }
            catch (HotelReservationException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Hotel Reservation System!");
            HotelSystem hotelSystem = new HotelSystem();

            hotelSystem.AddHotel(new Hotel("Lakewood", 110));
            hotelSystem.AddHotel(new Hotel("Bridgewood", 160));
            hotelSystem.AddHotel(new Hotel("Ridgewood", 220));
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome To Hotel Reservation System");

            HotelSystem hotelSystem = new HotelSystem(CustomerType.REGULAR);

            hotelSystem.AddHotel(new Hotel("Lakewood", 110, 90, 80, 80, 3));
            hotelSystem.AddHotel(new Hotel("Bridgewood", 150, 50, 110, 150, 4));
            hotelSystem.AddHotel(new Hotel("Ridgewood", 220, 150, 100, 40, 5));

            Console.WriteLine("Hotels Loaded......");

            UserInterface.UserInput(hotelSystem);
        }