Hotel Management System (original) (raw)
Last Updated : 5 Mar, 2024
Given the data for Hotel management and User:
**Hotel Data:
Hotel Name Room Available Location Rating Price per Room
H1 4 Bangalore 5 100
H2 5 Bangalore 5 200
H3 6 Mumbai 3 100
**User Data:
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.
**Approach:
- 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.
C++ `
// C++ program to solve // the given question
#include #include #include #include
using namespace std;
// Create class for hotel data. class Hotel { public: string name; int roomAvl; string location; int rating; int pricePr; };
// Create class for user data. class User : public Hotel { public: string uname; int uId; int cost; };
// Function to Sort Hotels by // Bangalore location bool sortByBan(Hotel& A, Hotel& B) { return A.name > B.name; }
// Function to sort hotels // by rating. bool sortByr(Hotel& A, Hotel& B) { return A.rating > B.rating; }
// Function to sort hotels // by rooms availability. bool sortByRoomAvailable(Hotel& A, Hotel& B) { return A.roomAvl < B.roomAvl; }
// Print hotels data. void PrintHotelData(vector hotels) { cout << "PRINT HOTELS DATA:" << endl; cout << "HotelName" << " " << "Room Available" << " " << "Location" << " " << "Rating" << " " << "PricePer Room:" << endl;
for (int i = 0; i < 3; i++) {
cout << hotels[i].name
<< " "
<< hotels[i].roomAvl
<< " "
<< hotels[i].location
<< " "
<< hotels[i].rating
<< " "
<< hotels[i].pricePr
<< endl;
}
cout << endl;}
// Sort Hotels data by name. void SortHotelByName(vector hotels) { cout << "SORT BY NAME:" << endl;
std::sort(hotels.begin(), hotels.end(),
sortByBan);
for (int i = 0; i < hotels.size(); i++) {
cout << hotels[i].name << " "
<< hotels[i].roomAvl << " "
<< hotels[i].location << " "
<< hotels[i].rating << " "
<< " " << hotels[i].pricePr
<< endl;
}
cout << endl;}
// Sort Hotels by rating void SortHotelByRating(vector hotels) { cout << "SORT BY A RATING:" << endl;
std::sort(hotels.begin(),
hotels.end(), sortByr);
for (int i = 0; i < hotels.size(); i++) {
cout << hotels[i].name << " "
<< hotels[i].roomAvl << " "
<< hotels[i].location << " "
<< hotels[i].rating << " "
<< " " << hotels[i].pricePr
<< endl;
}
cout << endl;}
// Print Hotels for any city Location. void PrintHotelBycity(string s, vector hotels) { cout << "HOTELS FOR " << s << " LOCATION IS:" << endl; for (int i = 0; i < hotels.size(); i++) {
if (hotels[i].location == s) {
cout << hotels[i].name << " "
<< hotels[i].roomAvl << " "
<< hotels[i].location << " "
<< hotels[i].rating << " "
<< " " << hotels[i].pricePr
<< endl;
}
}
cout << endl;}
// Sort hotels by room Available. void SortByRoomAvailable(vector hotels) { cout << "SORT BY ROOM AVAILABLE:" << endl;
std::sort(hotels.begin(), hotels.end(),
sortByRoomAvailable);
for (int i = hotels.size() - 1; i >= 0; i--) {
cout << hotels[i].name << " "
<< hotels[i].roomAvl << " "
<< hotels[i].location << " "
<< hotels[i].rating << " "
<< " " << hotels[i].pricePr
<< endl;
}
cout << endl;}
// Print the user's data void PrintUserData(string userName[], int userId[], int bookingCost[], vector hotels) {
vector<User> user;
User u;
// Access user data.
for (int i = 0; i < 3; i++) {
u.uname = userName[i];
u.uId = userId[i];
u.cost = bookingCost[i];
user.push_back(u);
}
// Print User data.
cout << "PRINT USER BOOKING DATA:"
<< endl;
cout << "UserName"
<< " "
<< "UserID"
<< " "
<< "HotelName"
<< " "
<< "BookingCost" << endl;
for (int i = 0; i < user.size(); i++) {
cout << user[i].uname
<< " "
<< user[i].uId
<< " "
<< hotels[i].name
<< " "
<< user[i].cost
<< endl;
}}
// Functiont to solve // Hotel Management problem void HotelManagement(string userName[], int userId[], string hotelName[], int bookingCost[], int rooms[], string locations[], int ratings[], int prices[]) { // Initialize arrays that stores // hotel data and user data vector hotels;
// Create Objects for
// hotel and user.
Hotel h;
// Initialise the data
for (int i = 0; i < 3; i++) {
h.name = hotelName[i];
h.roomAvl = rooms[i];
h.location = locations[i];
h.rating = ratings[i];
h.pricePr = prices[i];
hotels.push_back(h);
}
cout << endl;
// Call the various operations
PrintHotelData(hotels);
SortHotelByName(hotels);
SortHotelByRating(hotels);
PrintHotelBycity("Bangalore",
hotels);
SortByRoomAvailable(hotels);
PrintUserData(userName,
userId,
bookingCost,
hotels);}
// Driver Code. int main() {
// Initialize variables to stores
// hotels data and user data.
string userName[] = { "U1", "U2", "U3" };
int userId[] = { 2, 3, 4 };
string hotelName[] = { "H1", "H2", "H3" };
int bookingCost[] = { 1000, 1200, 1100 };
int rooms[] = { 4, 5, 6 };
string locations[] = { "Bangalore",
"Bangalore",
"Mumbai" };
int ratings[] = { 5, 5, 3 };
int prices[] = { 100, 200, 100 };
// Function to perform operations
HotelManagement(userName, userId,
hotelName, bookingCost,
rooms, locations,
ratings, prices);
return 0;}
Java
import java.util.*;
// Create class for hotel data. class Hotel implements Comparable { static String sortParam = "name"; String name; int roomAvl; String location; int rating; int pricePr;
// Constructor
public Hotel(String name, int roomAvl, String location, int rating, int pricePr) {
this.name = name;
this.roomAvl = roomAvl;
this.location = location;
this.rating = rating;
this.pricePr = pricePr;
}
// Function to change sort parameter to name
public static void sortByName() {
sortParam = "name";
}
// Function to change sort parameter to rating.
public static void sortByRate() {
sortParam = "rating";
}
// Function to change sort parameter to room availability.
public static void sortByRoomAvailable() {
sortParam = "roomAvl";
}
@Override
public int compareTo(Hotel other) {
switch(sortParam) {
case "name":
return this.name.compareTo(other.name);
case "rating":
return Integer.compare(this.rating, other.rating);
case "roomAvl":
return Integer.compare(this.roomAvl, other.roomAvl);
default:
return 0;
}
}
@Override
public String toString() {
return "PRHOTELS DATA:\nHotelName:" + this.name + "\tRoom Available:" + this.roomAvl + "\tLocation:" + this.location + "\tRating:" + this.rating + "\tPricePer Room:" + this.pricePr;
}}
// Create class for user data. class User { String uname; int uId; int cost;
// Constructor
public User(String uname, int uId, int cost) {
this.uname = uname;
this.uId = uId;
this.cost = cost;
}
@Override
public String toString() {
return "UserName:" + this.uname + "\tUserId:" + this.uId + "\tBooking Cost:" + this.cost;
}}
public class Main { // Print hotels data. public static void printHotelData(ArrayList hotels) { for (Hotel h : hotels) { System.out.println(h); } }
// Sort Hotels data by name.
public static void sortHotelByName(ArrayList<Hotel> hotels) {
System.out.println("SORT BY NAME:");
Hotel.sortByName();
Collections.sort(hotels);
printHotelData(hotels);
System.out.println();
}
// Sort Hotels by rating
public static void sortHotelByRating(ArrayList<Hotel> hotels) {
System.out.println("SORT BY A RATING:");
Hotel.sortByRate();
Collections.sort(hotels);
printHotelData(hotels);
System.out.println();
}
// Print Hotels for any city Location.
public static void printHotelByCity(String s, ArrayList<Hotel> hotels) {
System.out.println("HOTELS FOR " + s + " LOCATION ARE:");
ArrayList<Hotel> hotelsByLoc = new ArrayList<>();
for (Hotel h : hotels) {
if (h.location.equals(s)) {
hotelsByLoc.add(h);
}
}
printHotelData(hotelsByLoc);
System.out.println();
}
// Sort hotels by room Available.
public static void sortByRoomAvailable(ArrayList<Hotel> hotels) {
System.out.println("SORT BY ROOM AVAILABLE:");
Hotel.sortByRoomAvailable();
Collections.sort(hotels);
printHotelData(hotels);
System.out.println();
}
// Print the user's data
public static void printUserData(String[] userName, int[] userId, int[] bookingCost, ArrayList<Hotel> hotels) {
ArrayList<User> users = new ArrayList<>();
// Access user data.
for (int i = 0; i < 3; i++) {
User u = new User(userName[i], userId[i], bookingCost[i]);
users.add(u);
}
for (int i = 0; i < users.size(); i++) {
System.out.println(users.get(i) + "\tHotel name:" + hotels.get(i).name);
}
}
// Function to solve Hotel Management problem
public static void hotelManagement(String[] userName, int[] userId, String[] hotelName, int[] bookingCost, int[] rooms, String[] locations, int[] ratings, int[] prices) {
// Initialize array that stores hotel data
ArrayList<Hotel> hotels = new ArrayList<>();
// Initialise the data
for (int i = 0; i < 3; i++) {
Hotel h = new Hotel(hotelName[i], rooms[i], locations[i], ratings[i], prices[i]);
hotels.add(h);
}
System.out.println();
// Call the various operations
printHotelData(hotels);
sortHotelByName(hotels);
sortHotelByRating(hotels);
printHotelByCity("Bangalore", hotels);
sortByRoomAvailable(hotels);
printUserData(userName, userId, bookingCost, hotels);
}
// Driver Code.
public static void main(String[] args) {
// Initialize variables to stores hotels data and user data.
String[] userName = {"U1", "U2", "U3"};
int[] userId = {2, 3, 4};
String[] hotelName = {"H1", "H2", "H3"};
int[] bookingCost = {1000, 1200, 1100};
int[] rooms = {4, 5, 6};
String[] locations = {"Bangalore", "Bangalore", "Mumbai"};
int[] ratings = {5, 5, 3};
int[] prices = {100, 200, 100};
// Function to perform operations
hotelManagement(userName, userId, hotelName, bookingCost, rooms, locations, ratings, prices);
}}
C#
using System; using System.Collections.Generic; using System.Linq;
// Create class for hotel data. public class Hotel { public string Name { get; set; } public int RoomAvl { get; set; } public string Location { get; set; } public int Rating { get; set; } public int PricePr { get; set; } }
// Create class for user data. public class User : Hotel { public string Uname { get; set; } public int UId { get; set; } public int Cost { get; set; } }
public class Program { // Function to Sort Hotels by Bangalore location static int SortByBan(Hotel A, Hotel B) { return A.Name.CompareTo(B.Name); }
// Function to sort hotels by rating.
static int SortByr(Hotel A, Hotel B)
{
return B.Rating.CompareTo(A.Rating);
}
// Function to sort hotels by rooms availability.
static int SortByRoomAvailable(Hotel A, Hotel B)
{
return A.RoomAvl.CompareTo(B.RoomAvl);
}
// Print hotels data.
static void PrintHotelData(List<Hotel> hotels)
{
Console.WriteLine("PRINT HOTELS DATA:");
Console.WriteLine("HotelName Room Available Location Rating PricePer Room:");
for (int i = 0; i < 3; i++)
{
Console.WriteLine($"{hotels[i].Name} {hotels[i].RoomAvl} {hotels[i].Location} {hotels[i].Rating} {hotels[i].PricePr}");
}
Console.WriteLine();
}
// Sort Hotels data by name.
static void SortHotelByName(List<Hotel> hotels)
{
Console.WriteLine("SORT BY NAME:");
hotels.Sort(SortByBan);
foreach (var hotel in hotels)
{
Console.WriteLine($"{hotel.Name} {hotel.RoomAvl} {hotel.Location} {hotel.Rating} {hotel.PricePr}");
}
Console.WriteLine();
}
// Sort Hotels by rating
static void SortHotelByRating(List<Hotel> hotels)
{
Console.WriteLine("SORT BY A RATING:");
hotels.Sort(SortByr);
foreach (var hotel in hotels)
{
Console.WriteLine($"{hotel.Name} {hotel.RoomAvl} {hotel.Location} {hotel.Rating} {hotel.PricePr}");
}
Console.WriteLine();
}
// Print Hotels for any city Location.
static void PrintHotelBycity(string s, List<Hotel> hotels)
{
Console.WriteLine($"HOTELS FOR {s} LOCATION IS:");
foreach (var hotel in hotels)
{
if (hotel.Location == s)
{
Console.WriteLine($"{hotel.Name} {hotel.RoomAvl} {hotel.Location} {hotel.Rating} {hotel.PricePr}");
}
}
Console.WriteLine();
}
// Sort hotels by room Available.
static void SortByRoomAvailable(List<Hotel> hotels)
{
Console.WriteLine("SORT BY ROOM AVAILABLE:");
hotels.Sort(SortByRoomAvailable);
for (int i = hotels.Count - 1; i >= 0; i--)
{
Console.WriteLine($"{hotels[i].Name} {hotels[i].RoomAvl} {hotels[i].Location} {hotels[i].Rating} {hotels[i].PricePr}");
}
Console.WriteLine();
}
// Print the user's data
static void PrintUserData(string[] userName, int[] userId, int[] bookingCost, List<Hotel> hotels)
{
List<User> user = new List<User>();
// Access user data.
for (int i = 0; i < 3; i++)
{
User u = new User
{
Uname = userName[i],
UId = userId[i],
Cost = bookingCost[i]
};
user.Add(u);
}
// Print User data.
Console.WriteLine("PRINT USER BOOKING DATA:");
Console.WriteLine("UserName UserID HotelName BookingCost");
for (int i = 0; i < user.Count; i++)
{
Console.WriteLine($"{user[i].Uname} {user[i].UId} {hotels[i].Name} {user[i].Cost}");
}
}
// Function to solve Hotel Management problem
static void HotelManagement(string[] userName, int[] userId, string[] hotelName, int[] bookingCost, int[] rooms, string[] locations, int[] ratings, int[] prices)
{
// Initialize arrays that stores hotel data and user data
List<Hotel> hotels = new List<Hotel>();
// Initialise the data
for (int i = 0; i < 3; i++)
{
Hotel h = new Hotel
{
Name = hotelName[i],
RoomAvl = rooms[i],
Location = locations[i],
Rating = ratings[i],
PricePr = prices[i]
};
hotels.Add(h);
}
Console.WriteLine();
// Call the various operations
PrintHotelData(hotels);
SortHotelByName(hotels);
SortHotelByRating(hotels);
PrintHotelBycity("Bangalore", hotels);
SortByRoomAvailable(hotels);
PrintUserData(userName, userId, bookingCost, hotels);
}
// Driver Code.
public static void Main()
{
// Initialize variables to stores hotels data and user data.
string[] userName = { "U1", "U2", "U3" };
int[] userId = { 2, 3, 4 };
string[] hotelName = { "H1", "H2", "H3" };
int[] bookingCost = { 1000, 1200, 1100 };
int[] rooms = { 4, 5, 6 };
string[] locations = { "Bangalore", "Bangalore", "Mumbai" };
int[] ratings = { 5, 5, 3 };
int[] prices = { 100, 200, 100 };
// Function to perform operations
HotelManagement(userName, userId, hotelName, bookingCost, rooms, locations, ratings, prices);
}}
JavaScript
// javascript program to solve // the given question
// Create class for hotel data. class Hotel {
constructor(){
this.name = "";
this.roomAvl = 0;
this.location = "";
this.rating = 0;
this.pricePr = 0;
}}
// Create class for user data. class User{
constructor(){
this.uname = "";
this.uId = 0;
this.cost = 0;
}}
// Function to Sort Hotels by // Bangalore location function sortByBan(A, B) { return B.name.localeCompare(A.name); }
// Function to sort hotels // by rating. function sortByr(A, B) { return A.rating > B.rating; }
// Function to sort hotels // by rooms availability. function sortByRoomAvailable(A, B) { return A.roomAvl < B.roomAvl; }
// Print hotels data. function PrintHotelData(hotels) { console.log("PRINT HOTELS DATA:"); console.log("HotelName" + " " + "Room Available" + " " + "Location" + " " + "Rating" + " " + "PricePer Room:");
for (let i = 0; i < 3; i++) {
console.log(hotels[i].name
+ " "
+ hotels[i].roomAvl
+ " "
+ hotels[i].location
+ " "
+ hotels[i].rating
+ " "
+ hotels[i].pricePr);
}
console.log();}
// Sort Hotels data by name. function SortHotelByName(hotels) { console.log("SORT BY NAME:");
hotels.sort(sortByBan);
// console.log("h9");
// console.log(hotels);
for (let i = 0; i < hotels.length; i++) {
console.log(hotels[i].name + " " + hotels[i].roomAvl + " "
+ hotels[i].location + " "
+ hotels[i].rating + " "
+ " " + hotels[i].pricePr);
}
console.log();}
// Sort Hotels by rating function SortHotelByRating(hotels) { console.log("SORT BY A RATING:");
hotels.sort(sortByr);
for (let i = 0; i < hotels.length; i++) {
console.log(hotels[i].name + " "
+ hotels[i].roomAvl + " "
+ hotels[i].location + " "
+ hotels[i].rating + " "
+ " " + hotels[i].pricePr);
}
console.log();}
// Print Hotels for any city Location. function PrintHotelBycity(s, hotels) { console.log("HOTELS FOR " + s + " LOCATION IS:");
for (let i = 0; i < hotels.length; i++) {
if (hotels[i].location == s) {
console.log(hotels[i].name + " "
+ hotels[i].roomAvl + " "
+ hotels[i].location + " "
+ hotels[i].rating + " "
+ " " + hotels[i].pricePr);
}
}
console.log();}
// Sort hotels by room Available. function SortByRoomAvailable(hotels) { console.log("SORT BY ROOM AVAILABLE:");
hotels.sort(sortByRoomAvailable);
for (let i = hotels.length - 1; i >= 0; i--) {
console.log(hotels[i].name + " " + hotels[i].roomAvl + " " + hotels[i].location + " " + hotels[i].rating + " " +hotels[i].pricePr);
}
console.log();}
// Print the user's data function PrintUserData(userName, userId, bookingCost, hotels) {
let user = [];
// Access user data.
for (let i = 0; i < 3; i++) {
let u = new User();
u.uname = userName[i];
u.uId = userId[i];
u.cost = bookingCost[i];
user.push(u);
}
// Print User data.
console.log("PRINT USER BOOKING DATA:")
console.log("UserName UserID HotelName BookingCost")
for (let i = 0; i < user.length; i++) {
console.log(user[i].uname + " " + user[i].uId + " " + hotels[i].name + " " + user[i].cost);
}}
// Functiont to solve // Hotel Management problem function HotelManagement(userName,userId, hotelName, bookingCost, rooms, locations, ratings, prices) { // Initialize arrays that stores // hotel data and user data let hotels = [];
// Create Objects for
// hotel and user.
// Initialise the data
for (let i = 0; i < 3; i++) {
let h = new Hotel();
h.name = hotelName[i];
h.roomAvl = rooms[i];
h.location = locations[i];
h.rating = ratings[i];
h.pricePr = prices[i];
hotels.push(h);
}
console.log();
// Call the various operations
PrintHotelData(hotels);
SortHotelByName(hotels);
SortHotelByRating(hotels);
PrintHotelBycity("Bangalore", hotels);
SortByRoomAvailable(hotels);
PrintUserData(userName, userId, bookingCost, hotels);}
// Driver Code. // Initialize variables to stores // hotels data and user data. let userName = ["U1", "U2", "U3"]; let userId = [2, 3, 4]; let hotelName = ["H1", "H2", "H3" ]; let bookingCost = [1000, 1200, 1100 ]; let rooms = [4, 5, 6 ]; let locations = ["Bangalore", "Bangalore", "Mumbai" ]; let ratings = [5, 5, 3 ]; let prices = [100, 200, 100 ];
// Function to perform operations HotelManagement(userName, userId, hotelName, bookingCost, rooms, locations, ratings, prices);
// the code is contributed by Nidhi goel.
Python3
Python program to solve
the given question
Create class for hotel data.
class Hotel : sortParam='name' def init(self) -> None: self.name='' self.roomAvl=0 self.location='' self.rating=int self.pricePr=0
def __lt__(self,other):
getattr(self,Hotel.sortParam)<getattr(other,Hotel.sortParam)
# Function to change sort parameter to
# name
@classmethod
def sortByName(cls):
cls.sortParam='name'
# Function to change sort parameter to
# rating.
@classmethod
def sortByRate(cls):
cls.sortParam='rating'
# Function to change sort parameter to
# room availability.
@classmethod
def sortByRoomAvailable(cls) :
cls.sortParam='roomAvl'
def __repr__(self) -> str:
return "PRHOTELS DATA:\nHotelName:{}\tRoom Available:{}\tLocation:{}\tRating:{}\tPricePer Room:{}".format(self.name,self.roomAvl,self.location,self.rating,self.pricePr)Create class for user data.
class User: def init(self) -> None: self.uname='' self.uId=0 self.cost=0
def __repr__(self) -> str:
return "UserName:{}\tUserId:{}\tBooking Cost:{}".format(self.uname,self.uId,self.cost)Print hotels data.
def PrintHotelData(hotels): for h in hotels: print(h)
Sort Hotels data by name.
def SortHotelByName(hotels): print("SORT BY NAME:")
Hotel.sortByName()
hotels.sort()
PrintHotelData(hotels)
print()Sort Hotels by rating
def SortHotelByRating(hotels): print("SORT BY A RATING:")
Hotel.sortByRate()
hotels.sort()
PrintHotelData(hotels)
print()Print Hotels for any city Location.
def PrintHotelBycity(s,hotels): print("HOTELS FOR {} LOCATION ARE:".format(s)) hotelsByLoc=[h for h in hotels if h.location==s]
PrintHotelData(hotelsByLoc)
print()Sort hotels by room Available.
def SortByRoomAvailable(hotels): print("SORT BY ROOM AVAILABLE:") Hotel.sortByRoomAvailable() hotels.sort() PrintHotelData(hotels) print()
Print the user's data
def PrintUserData(userName, userId, bookingCost, hotels): users=[] # Access user data. for i in range(3) : u=User() u.uname = userName[i] u.uId = userId[i] u.cost = bookingCost[i] users.append(u)
for i in range(len(users)) :
print(users[i],"\tHotel name:",hotels[i].name)Functiont to solve
Hotel Management problem
def HotelManagement(userName, userId, hotelName, bookingCost, rooms, locations, ratings, prices): # Initialize arrays that stores # hotel data and user data hotels=[]
# Create Objects for
# hotel and user.
# Initialise the data
for i in range(3) :
h=Hotel()
h.name = hotelName[i]
h.roomAvl = rooms[i]
h.location = locations[i]
h.rating = ratings[i]
h.pricePr = prices[i]
hotels.append(h)
print()
# Call the various operations
PrintHotelData(hotels)
SortHotelByName(hotels)
SortHotelByRating(hotels)
PrintHotelBycity("Bangalore",
hotels)
SortByRoomAvailable(hotels)
PrintUserData(userName,
userId,
bookingCost,
hotels)Driver Code.
if name == 'main':
# Initialize variables to stores
# hotels data and user data.
userName = ["U1", "U2", "U3"]
userId = [2, 3, 4]
hotelName = ["H1", "H2", "H3"]
bookingCost = [1000, 1200, 1100]
rooms = [4, 5, 6]
locations = ["Bangalore",
"Bangalore",
"Mumbai"]
ratings = [5, 5, 3]
prices = [100, 200, 100]
# Function to perform operations
HotelManagement(userName, userId,
hotelName, bookingCost,
rooms, locations,
ratings, prices)`
Output
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