CSD201_-_T1_2896.webp
M

CSD201_-_T1_2896.webp

  • Media owner Maki95
  • Ngày thêm
Bài viết gốc: Chủ đề 'CSD201 - T1'
Zoom
O size (must be > 0): the maximum number of people renting/using this Room
O price (must be > 0)
Class Node: includes info (a Room object) and next (a pointer for linking).
Class dataList: is a singly linked list that manages regular Nodes with complete information. This class plays the role of managing all Room in the Hotel.
Class requestQueue: is a queue structure (implemented as a linked list), where the
component info of the Nodes contains only size (the number of people renting the Room)and price (the expected price, or the maximum money the the customer(s) can pay). Note:size>0 and price>0.
1
Class Hotel: is the main class of the program, containing a dataList used to manage the Room objects and a requestQueue corresponding to a queue of order.
Students are required to carefully read the provided code segments to fully understand the relationships between the classes and the functions within each class. The specific task of the test is to execute the following requirements:
a. fl(): 2.5 marks - Load data
To complete the requirement f1(), students need to fulfill two specific tasks: implement the function addLast() in the dataList class and the function en Queue() (similar to addLast)
in the requestQueue class.
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)
b. f2(): 2.5 marks - Serve the first request in the requestQueue
To complete the requirement f2(), students need to perform three specific tasks: (1)implement the deQueue() function of the requestQueue structure, (2) use the returned the first request in the body of f2() function.
result of deQueue() to perform the rent() function, then (3) use these two functions to serve
The rent() action consists of two steps:
o First, search the best Room to rent. If found, proceed to step 2. The best Room is:
An empty Room

Size > the size in the request Price <= the price in the price
+ 100%
Ur
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
CSD201_-_T1_2896.webp
File size
337.7 KB
Dimensions
1920px x 867px

Share this media

Back
Bên trên Bottom