You are on page 1of 2

𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻:

Write the Resort and Room class with the required properties to give the following outputs as shown.

𝐂𝐨𝐝𝐞:
#Write your code here…………….

h = Resort("Sayeman")

h.addRooms(Room("Pool view"))

h.addRooms(Room("Pool view"))

h.addRooms(Room("Delux"))

r1 = Room("Garden view")

h.addRooms(r1)

print("=========================")

h.printDetails()

print("=========================")

h.addRooms(Room("Pool view"))

h.addRooms(Room("Sea view"))

h.addRooms(Room("Delux"))

r2 = Room("Garden view")

h.addRooms(r2)

print("=========================")

h.printDetails()

print("=========================")

h.addRooms(Room("Sea view"))

h.addRooms(Room("Garden view"))

r3 = Room("Garden view")

h.addRooms(Room("Delux"))

h.addRooms(r3)

print("=========================")

h.printDetails()

print("=========================")
𝐎𝐮𝐭𝐩𝐮𝐭:
=========================
Resort Name: Sayeman
Total Number of rooms: 4
Pool view room numbers: 101,102
Deluxe room numbers: 103
Garden view room numbers: 104
=========================
=========================
Resort Name: Sayeman
Total Number of rooms: 8
Pool view room numbers: 101,102,201
Deluxe room numbers: 103,203
Garden view room numbers: 104,204
Sea view room numbers: 202
=========================
=========================
Resort Name: Sayeman
Total Number of rooms: 12
Pool view room numbers: 101,102,201
Deluxe room numbers: 103,203,304
Garden view room numbers: 104,204,302,303
Sea view room numbers: 202,301
=========================

[Hint:
Room no = (“Floor No.” + “0” + “Room number”)
Every floor has 4 rooms.
So room numbers of 1st floor will be: 101,102,103,104
Room numbers of 2nd floor will be: 201,202,203,204
and so on.

Every time we add a room to the resort, room number will automatically increase by 1
starting from 101. As soon as there are 4 rooms in one floor, we will move to next floor and
allocate room numbers accordingly.]

You might also like