CSD201_-_T1_2875.webp
minhhoa2004

CSD201_-_T1_2875.webp

Bài viết gốc: Chủ đề 'CSD201 - T1'
satisfy four conditions below, the answer is Room 003.
o If the best Room is found, perform the renting action: update the status in the dataList from 0 to 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)
Request: (1,100) (12,500) (4,50) (4,400)
Data List: (001,0,10,200) (003,1,3,70) (004,0,4,100) (005,0,3,70)
Request: (12,500) (4,50) (4,400)
Explaination:
o The request (1,100) will be removed from the requestQueue, and then this request will be processed.
o The request is for renting a room for one person (size=1), with the available money being 100 (price=100).
o The system finds two suitable rooms (empty (status=0), priced <100, with the lowest price being 70), which are 003 and 005.
o The system then choose room 003 because it appears before room 005 in the dataList. Finally, the status of this room will be updated to status=1 to indicate that it is now used.
c. f3(): 2.5 marks - Serve all requests in the requestQueue You should perform the pair of operations deQueue() and rent() for all elements in the requestQueue.
2
The expected output used to test your code are as follows:
Zoom
+ 93%
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
CSD201_-_T1_2875.webp
File size
206.8 KB
Dimensions
1145px x 802px

Share this media

Back
Bên trên Bottom