Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hint: Linked-List Description: C++ (Data Structure and Algorithm You are a manager of a hotel. You have a number of rooms and a number of

Hint: Linked-List Description: C++ (Data Structure and Algorithm You are a manager of a hotel. You have a number of rooms and a number of customers requesting rooms. Customers want rooms with different number of beds. In your hotel, you have 100 rooms with only one bed, 50 rooms with 2 beds and 30 rooms with 3 beds. A. Create two efficient classes: Room, Customer; in their own h and/or cpp files. The room has information such as the customer whos currently occupying it, when the customer gets the room (check in date), when the customer is leaving the room (check out date), and the number of beds in the room. The Customer class carries the customer id and the number of requested beds. Write an efficient program that slots as many as customers into the hotel. If your best available room has more beds than what customer asked for, you should assign that room to the customer. But switching the room when its assigned is not allowed. If the number of beds requested by customer is more than the biggest number of beds in all rooms, the program must accommodate the customer with more than one room. For example, if the customer asks for 5 beds, and the available rooms of hotel has maximum 3 beds, the best choice is to accommodate the customer with a room of 3 beds and a room of 2 beds. However, if room with 2 beds is not available, then 2 room of 3 beds may be a good choice. Alternatively, there is another choice like 1 room of 3 beds and 2 rooms of 1 bed. Your program must decide which one is the best. In the real worlds problem, you always have to compromise and there is no best solution for all the situations. If it is not possible to assign room(s) to a customer, you program must declare that by sending an appropriate message. Your program cant refuse to accommodate a customer if there are available room(s). Finally, the program must report how many customers have been serviced as total. To test your program, you can use input.txt file which is already provided and simulates the requests of random customers. The file includes data such as date, customer identification number, number of requested bed(s), and duration of stay in terms of day(s). The following shows a line of the file: 1/1/2018, JRN65PZSP0, 3, 5 which means customer with id number 843A62A1MR has checked-in to a room with at least 3 beds on Jan 1, 2018, and (s)he has checked-out that room on Jan 8, 2018. In other words, this room is available again on Jan 8, 2018. To simplify the program, consider that the records in the file are issued in the same day as check-in date (ie. for each record check-in is today). input.txt Check-in-Date, customerID, No.of requested beds, Duration of Stay 1/1/2018, JRN65PZSP0, 3, 5 1/1/2018, URR4XMS2NL, 3, 6 1/1/2018, S9YM7KKOL5, 3, 8 1/1/2018, O3XF3FXUHA, 2, 23 1/1/2018, FGIBAYU99X, 3, 4 1/1/2018, LQ3GCV6ZF0, 3, 7 1/1/2018, AFV6AMQEFT, 3, 17 1/1/2018, 97F7RV2LSE, 1, 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions