static void Main(string[] args) { Console.WriteLine("Welcome to Hotels in Miami!"); //Welcome to Hotel Reservation System inputFromUserserInput(); //Input Date Range and Customer Type from User HotelReservation hotelReservation = new HotelReservation(); AddSampleHotels(hotelReservation); //Add Hotel Name to HotelList //Find the cheapest hotel in the date Range var cheapestHotels = hotelReservation.FindCheapestHotels(startDate, endDate, customerType); var cost = hotelReservation.CalculateTotalCost(cheapestHotels[0], startDate, endDate, customerType); //Print the name and cost Console.WriteLine("Hotel: {0}, Total Cost : {1}", cheapestHotels[0].name, cost); //Print the Name of first Element if same //Best Rated Hotel in the date Range var bestRatedHotel = hotelReservation.FindBestRatedHotel(startDate, endDate); Console.WriteLine("Hotel: {0} Rating: {1}", bestRatedHotel[0].name, bestRatedHotel[0].rating); //Best and cheapest hotels var bestandcheapesthotel = hotelReservation.FindCheapestBestRatedHotel(endDate, endDate, customerType); var totalcost = hotelReservation.CalculateTotalCost(cheapestHotels[0], startDate, endDate, customerType); Console.WriteLine("Hotel: {0} Rating {1} Cost ", bestandcheapesthotel[0].name, bestandcheapesthotel[0].rating, cost); }
static void Main(string[] args) { Console.WriteLine("Welcome to Hotel Reservation System!"); TakeInput(); var hotelReservation = new HotelReservation(); AddSampleHotels(hotelReservation); var cheapestHotels = hotelReservation.FindCheapestBestRatedHotel(startDate, endDate, customerType); var cost = hotelReservation.CalculateTotalCost(cheapestHotels[0], startDate, endDate, customerType); var hotelString = HotelString(cheapestHotels); Console.WriteLine("{0}, Total Cost : {1}", hotelString, cost); }
//UC2 - UC4 public static void FindCheapest(HotelReservation hotelReservation, CustomerType ct) { Console.WriteLine("Cheapest Hotel"); Console.Write("Enter the date range : "); var input = Console.ReadLine(); string[] dates = input.Split(','); try { var startDate = Convert.ToDateTime(dates[0]); var endDate = Convert.ToDateTime(dates[1]); var cheapestHotel = hotelReservation.FindCheapestHotels(startDate, endDate, ct); foreach (Hotel h in cheapestHotel) { var cost = hotelReservation.CalculateTotalCost(h, startDate, endDate, ct); Console.WriteLine("Hotel : {0}, Total Cost : {1}", h.name, cost); } } catch { Console.Write("Enter the correct date range \n"); FindCheapest(hotelReservation, ct); } }