CSD201_-_PE_-_03_3199.webp
fresh_air

CSD201_-_PE_-_03_3199.webp

Bài viết gốc: Chủ đề 'CSD201 - PE - 03'
2
You should perform the pair of operations deQueue() and rent() for all elements in the requestQueue.
The expected output used to test your code are as follows:
Data List: (001,0,10,200) (003,0,3,70) (004,0,4,100) (005,0,3,70) (VIP,0,10,80)
Request: (1,100) (12,500) (4,50) (4,400)
Data List: (001,0,10,200) (003,0,3,70) (004,0,4,100) (005,1,3,70) (VIP,1,10,80)
Request: Empty
Explaination:
• Similar to the f2() function, the request (1,100) will be served in Room 005.
o The request (12,500) will not find a suitable Room due to the large number of people (size=12), which exceeds the size of all available Rooms.
o The request (4,50) also fails to find a Room because it carries too little money (price-50), specifically less than the price of the cheapest Room (price=70).
o The request (4,400) has one suitable Room: VIP because it is available, enough capacity, and has the lowest price.
o As a result, Rooms 005 and VIP are rented, and the requestQueue is empty.
d. f4(): 2.5 marks Compute the total revenue (money) of the Hotel after serving all the requests in the queue.
You should: (1) perform the pair of operations deQueue() and rent() for all elements in the requestQueue, then (2) compute the total revenue of the Rooms with status=1.
The expected output used to test your code are as follows:
Data List: (001,0,10,200) (003,0,3,70) (004,0,4,100) (005,0,3,70) (VIP,0,10,80)
Request : (1,100) (12,500) (4,50) (4,400)
Data List: (001,0,10,200) (003,0,3,70) (004,0,4,100) (005,1,3,70) (VIP,1,10,80)
Request: Empty
Total Revenue: 150
Explaination:
Similar to the function f3(), Rooms 005 and VIP are rented. At that point, the total revenue is: 70+80= 150.
-- End ---
Zoom
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
fresh_air
Ngày thêm
Lượt xem
3,998
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_PE_-_03_3199.webp
File size
452.5 KB
Dimensions
2560px x 1494px

Share this media

Back
Bên trên Bottom