Hotel Management System
Given the data for Hotel management and User:
Hotel Name Room Available Location Rating Price per Room H1 4 Bangalore 5 100 H2 5 Bangalore 5 200 H3 6 Mumbai 3 100
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
User Name UserID Booking Cost U1 2 1000 U2 3 1200 U3 4 1100
The task is to answer the following question.
- Print the hotel data.
- Sort hotels by Name.
- Sort Hotel by highest rating.
- Print Hotel data for Bangalore Location.
- Sort hotels by maximum number of rooms Available.
- Print user Booking data.
Machine coding round involves solving a design problem in a matter of a couple of hours.
It requires designing and coding a clean, modular and extensible solution based on a specific set of requirements.
- Create classes for Hotel data and User data.
- Initialize variables that stores Hotel data and User data.
- Create Objects for Hotel and user classes that access the Hotel data and User data.
- initialize two vector array that holds the hotel data and user data.
- solve the Above questions one by one.
Below is the implementation of the above approach.
PRINT HOTELS DATA: HotelName Room Available Location Rating PricePer Room: H1 4 Bangalore 5 100 H2 5 Bangalore 5 200 H3 6 Mumbai 3 100 SORT BY NAME: H3 6 Mumbai 3 100 H2 5 Bangalore 5 200 H1 4 Bangalore 5 100 SORT BY A RATING: H1 4 Bangalore 5 100 H2 5 Bangalore 5 200 H3 6 Mumbai 3 100 HOTELS FOR Bangalore LOCATION IS: H1 4 Bangalore 5 100 H2 5 Bangalore 5 200 SORT BY ROOM AVAILABLE: H3 6 Mumbai 3 100 H2 5 Bangalore 5 200 H1 4 Bangalore 5 100 PRINT USER BOOKING DATA: UserName UserID HotelName BookingCost U1 2 H1 1000 U2 3 H2 1200 U3 4 H3 1100