示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Hotel Reservation System!");

            var hotelReservation = new HotelReservation();

            var cusType = GetCustomerType();
            //AddHotelManually(hotelReservation);
            AddSampleHotels(hotelReservation);

            FindCheapest(hotelReservation, cusType);
            FindCheapestBest(hotelReservation, cusType);
            FindBest(hotelReservation, cusType);
            /*Console.WriteLine("1.Cheapest or 2.Best cheapest or 3.Best Rated?");
            switch(Convert.ToInt32(Console.ReadLine()))
            {
                case 1:
                    {
                        FindCheapest(hotelReservation);
                        break;
                    }
                case 2:
                    {
                        FindCheapestBest(hotelReservation);
                        break;
                    }
                case 3:
                    {
                        FindBest(hotelReservation);
                        break;
                    }
            }
            */
        }
示例#2
0
        //UC1
        public static HotelReservation AddHotelManually(HotelReservation hotelReservation)
        {
            bool val = true;
            while (val)
            {
                var hotel = new Hotel();
                Console.Write("Enter Hotel Name : ");
                hotel.name = Console.ReadLine();

                Console.Write("Enter Regular Weekday Rate : ");
                hotel.weekdayRatesRegular = Convert.ToInt32(Console.ReadLine());

                Console.Write("Enter Regular Weekend Rate : ");
                hotel.weekendRatesRegular = Convert.ToInt32(Console.ReadLine());

                Console.Write("Enter Loyalty Weekday Rate :  ");
                hotel.weekdayRatesLoyalty = Convert.ToInt32(Console.ReadLine());

                Console.Write("Enter Loyalty Weekend Rate :  ");
                hotel.weekendRatesLoyalty = Convert.ToInt32(Console.ReadLine());

                Console.Write("Enter Hotel Rating (5 being best, 1 being worst) : ");
                hotel.rating = Convert.ToInt32(Console.ReadLine());

                hotelReservation.AddHotel(hotel);

                Console.WriteLine("Wanna add more hotels?(yes/no)");
                if (Console.ReadLine() == "no")
                    val = false;
            }
            return hotelReservation;
        }
示例#3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.InsertHotelDetailsByConsole();
        }
示例#4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Hotel Reservation Program:\n");
            HotelReservation.AddRatingsAndHotel();
            bool flag = true;

            while (flag)
            {
                Console.WriteLine("\nEnter:\n1.To find cheapest hotels\n2.To find best rated hotel\n3.To find cheapest best rated hotel\n4.To exit\n");
                int options = Convert.ToInt32(Console.ReadLine());
                switch (options)
                {
                case 1:
                    //UC 2
                    HotelReservation.FindCheapestHotel();
                    break;

                case 2:
                    //UC 7
                    HotelReservation.FindBestRatedHotel();
                    break;

                case 3:
                    //UC 6
                    HotelReservation.FindCheapestBestRatedHotel();
                    break;

                case 4:
                    flag = false;
                    break;
                }
            }
        }
        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);
        }
示例#6
0
        public static HotelReservation AddSampleHotels(HotelReservation hotelReservation)
        {
            hotelReservation.AddHotel(new Hotel { name = "Lakewood", weekdayRatesRegular = 110, weekendRatesRegular = 90, weekdayRatesLoyalty = 80, weekendRatesLoyalty = 80, rating = 3 });
            hotelReservation.AddHotel(new Hotel { name = "Bridgewood", weekdayRatesRegular = 160, weekendRatesRegular = 60, weekdayRatesLoyalty = 110, weekendRatesLoyalty = 50, rating = 4 });
            hotelReservation.AddHotel(new Hotel { name = "Ridgewood", weekdayRatesRegular = 220, weekendRatesRegular = 150, weekdayRatesLoyalty = 100, weekendRatesLoyalty = 40, rating = 5 });

            return hotelReservation;

        }
示例#7
0
        static void Main(string[] args)
        {
            HotelReservation hotelReservation = new HotelReservation();

            Console.WriteLine("Welcome to Hotel Reservation Program");
            //instatiating hotel reservations
            List <DayOfWeek> datesList;

            //getting input from user
            string[] datesArray = InputCustomerTypeAndDate();

            //adding data into hotel list in hotel reservations using customer type
            AddingHotelDataAccToCustomerType(hotelReservation, datesArray);

            //adding dates in list and converting them to days of week
            //if date input is not in correct form, then custom exception thrown by method is catched.
            try
            {
                datesList = hotelReservation.AddingDatesInList(datesArray);
            }
            catch (HotelReservationCustomExceptions ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }

            //iterating loop until user wants to find best hotels
            while (true)
            {
                Console.WriteLine("Please Enter 1 to find cheapest hotel\nPlease Enter 2 to find hotel with best ratings");
                //reading input to choose between cheap hotel or best rated hotel
                int option = Convert.ToInt32(Console.ReadLine());
                switch (option)
                {
                case 1:
                    //calling the method for getting cheapest hotel for given dates
                    hotelReservation.CheapestHotelForGivenDates(datesList);
                    break;

                case 2:
                    //calling method to calculate best rated hotel
                    hotelReservation.FindingHotelsWithBestRatings(datesList);
                    break;

                default:
                    Console.WriteLine("Please enter the correct input");
                    break;
                }
                Console.WriteLine("Do you want to find out again,press y to check again");
                string check = Console.ReadLine();
                if (!(check.ToLower().Equals("y")))
                {
                    break;
                }
            }
        }
        //private method to call FindBestHotel Method
        private static void GetBestHotel()
        {
            DateTime[]       dates               = AskStartAndEndDate();
            CustomerType     custType            = AskCustomerType();
            HotelReservation hotelReservationObj = new HotelReservation(custType, dates[0], dates[1]);
            string           bestHotel           = hotelReservationObj.FindBestHotel();
            int cheapestRate = hotelReservationObj.FindCheapestTotalRate();

            ColouredPrint.PrintInRed($"Best Hotel is {bestHotel} with Total rate {cheapestRate} and Rating {hotelReservationObj.FindBestHotelRating()}");
        }
        //private method to call FindHighestRatedHotel method
        private static void GetHighestRatedHotel()
        {
            DateTime[]       dates               = AskStartAndEndDate();
            CustomerType     custType            = AskCustomerType();
            HotelReservation hotelReservationObj = new HotelReservation(custType, dates[0], dates[1]);
            string           highestRatedHotel   = hotelReservationObj.FindHighestRatedHotel();
            int highestRatedHotelTotalRate       = hotelReservationObj.FindHigestRatedHotelTotalRate();
            int highestRatedHotelRating          = hotelReservationObj.FindHighestRatedHotelRating();

            ColouredPrint.PrintInRed($"Highest Rated hotel is {highestRatedHotel} with Total Fare {highestRatedHotelTotalRate} and Rating {highestRatedHotelRating}");
        }
示例#10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Hotel Reservation Program:\n");
            //Addition of hotel with ratings into records
            HotelReservation.AddRatingsAndHotel();
            //Choosing if the user is regular or rewards
            Console.WriteLine("Enter:\n1.If you are a REGULAR customer\n2.If you are a REWARDS customer");
            int          customerTypeChoice = Convert.ToInt32(Console.ReadLine());
            CustomerType customerType;

            if (customerTypeChoice == 1)
            {
                customerType = CustomerType.REGULAR_CUSTOMER;
            }
            else
            {
                customerType = CustomerType.REWARDS_CUSTOMER;
            }
            //Getting dates from user
            Console.WriteLine("Enter the check-in date(DDMMMYYYY):");
            DateTime checkinDate = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Enter the check-out date(DDMMMYYYY):");
            DateTime checkoutDate = DateTime.Parse(Console.ReadLine());

            bool flag = true;

            while (flag)
            {
                Console.WriteLine("\nEnter:\n1.To find cheapest hotels\n2.To find best rated hotel\n3.To find cheapest best rated hotel\n4.To exit\n");
                int options = Convert.ToInt32(Console.ReadLine());
                switch (options)
                {
                case 1:
                    //UC 2
                    HotelReservation.FindCheapestHotel(checkinDate, checkoutDate, customerType);
                    break;

                case 2:
                    //UC 7
                    HotelReservation.FindBestRatedHotel(checkinDate, checkoutDate, customerType);
                    break;

                case 3:
                    //UC 6
                    HotelReservation.FindCheapestBestRatedHotel(checkinDate, checkoutDate, customerType);
                    break;

                case 4:
                    flag = false;
                    break;
                }
            }
        }
示例#11
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to The Hotel Reservation System in Miami");

            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.GetDetailsfortheHotel();              //Add Name, Week Rates, Weekend Rates, Rating and Special Rewards to the Hotel System


            hotelReservation.GettheDateRangeforBooking();           // To get the Cheapest Best Rated Hotel Available for Reward Customers

            hotelReservation.DisplayHotels();                       //To Display the Details of the Hotel
        }
示例#12
0
        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);
        }
示例#13
0
        static void Main(string[] args)
        {
            Console.WriteLine("********************************************************");
            Console.WriteLine("**********WELCOME TO HOTEL RESERVATION PROGRAM**********");
            Console.WriteLine("********************************************************");
            /// Object of the HotelReservation class
            HotelReservation hotelReservation = new HotelReservation();

            /// Adding hotel's name and rate
            hotelReservation.AddHotel("Lakewood", 110);
            hotelReservation.AddHotel("Bridgewood", 160);
            hotelReservation.AddHotel("Ridgewood", 220);
            /// Cheapest hotel
            hotelReservation.CheapestHotel();
        }
        //Private method to call FindCheapestHotels method
        private static void GetCheapestHotels()
        {
            DateTime[]       dates               = AskStartAndEndDate();
            CustomerType     custType            = AskCustomerType();
            HotelReservation hotelReservationObj = new HotelReservation(custType, dates[0], dates[1]);
            List <string>    cheapestHotels      = hotelReservationObj.FindCheapestHotels();
            int cheapestRate = hotelReservationObj.FindCheapestTotalRate();

            ColouredPrint.PrintInRed("Cheapest hotels is/are : ", false, false);
            foreach (string hotel in cheapestHotels)
            {
                ColouredPrint.PrintInRed($"{hotel}");
            }
            ColouredPrint.PrintInRed($"Cheapest Rate is {cheapestRate}");
        }
示例#15
0
        public string findCheapestHotel()
        {
            int min = int.MaxValue;
            HotelReservation cheapestHotel = null;

            foreach (HotelReservation hotel in hotelList)
            {
                if (hotel.rateForRegularCustomer < min)
                {
                    cheapestHotel = hotel;
                    min           = hotel.rateForRegularCustomer;
                }
            }
            return(cheapestHotel.Name);
        }
示例#16
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Hotel Reservation Program\n");
            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.AddHotels();
            Console.WriteLine("Enter the check-in date informat dd/mm/yyyy");
            string   checkIn     = Console.ReadLine();
            DateTime checkInDate = DateTime.ParseExact(checkIn, "dd/mm/yyyy", CultureInfo.InvariantCulture);

            Console.WriteLine("Enter the check-out date informat dd/mm/yyyy");
            string   checkOut     = Console.ReadLine();
            DateTime checkOutDate = DateTime.ParseExact(checkOut, "dd/mm/yyyy", CultureInfo.InvariantCulture);

            hotelReservation.CheapestHotel(checkInDate, checkOutDate);
        }
示例#17
0
 /// <summary>
 /// Addings the type of the hotel data acc to customer.
 /// </summary>
 /// <param name="hotelReservation">The hotel reservation.</param>
 /// <param name="datesArray">The dates array.</param>
 public static void AddingHotelDataAccToCustomerType(HotelReservation hotelReservation, string[] datesArray)
 {
     try
     {
         //first input was taken as customer type, which is seperated and assigned to customer type
         string customerType = datesArray[0];
         //calling method for adding hotels in list
         hotelReservation.AddingHotelsInList(customerType);
         //creating day of week dates list
     }
     catch (HotelReservationCustomExceptions ex)
     {
         Console.WriteLine(ex.Message);
         Environment.Exit(0);
     }
 }
示例#18
0
        public static void TakeInput()
        {
            Console.Write("Enter the type of Customer : ");
            var type = Console.ReadLine().ToLower();

            if (!HotelReservation.ValidateCustomerType(type))
            {
                throw new HotelReservationException(ExceptionType.INVALID_CUSTOMER_TYPE, "Customer Type is invalid");
            }

            customerType = HotelReservation.GetCustomerType(type);
            Console.Write("Enter the date range : ");
            var input = Console.ReadLine();

            string[] dates = input.Split(',');
            startDate = Convert.ToDateTime(dates[0]);
            endDate   = Convert.ToDateTime(dates[1]);
        }
        public static void inputFromUserserInput()
        {
            Console.Write("Enter the type of Customer : ");                                         //Enter the Type of Customer
            var type = Console.ReadLine().ToLower();

            if (!HotelReservation.ValidateCustomerType(type))
            {
                throw new HotelReservationException(ExceptionType.INVALID_CUSTOMER_TYPE, "Customer Type is invalid"); //Check Validation to return Exception
            }
            customerType = HotelReservation.GetCustomerType(type);                                                    //Set the type of Customer

            Console.Write("Enter the date range : ");
            var input = Console.ReadLine();                                                          //Insert Date in dd/mm/yyyy form with , seoartator

            string[] dates = input.Split(',');

            startDate = Convert.ToDateTime(dates[0]);
            endDate   = Convert.ToDateTime(dates[1]);
        }
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Welcome to Hotel Reservation System\n");
            HotelReservation.DefiningAdditionRepository(CustomerType.REGULAR);
            HotelReservation.DefiningAdditionRepository(CustomerType.REWARD);
            HotelReservation.DisplayRecordsInDictionary();
            Console.WriteLine("Have you upgraded from the regular customer then enter yes.");
            string choice = Console.ReadLine().ToLower();

            if (choice == "yes")
            {
                FunctionForCustomerType(2);
            }
            else
            {
                FunctionForCustomerType(1);
            }
            Console.ReadKey();
        }
示例#21
0
 //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);
     }
 }
 public static void FunctionForCustomerType(int type)
 {
     HotelReservation.FindCheapestHotel(type);
     HotelReservation.FindCheapestBestRatedHotels(type);
     HotelReservation.FindBestRatedHotel(type);
 }