In a system for a restaurant, the main scenario for placing order is given…
2019
In a system for a restaurant, the main scenario for placing order is given below:
(a) Customer reads menu
(b) Customer places order
(c) Order is sent to kitchen for preparation
(d) Ordered items are served
(e) Customer requests for a bill for the order
(f) Bill is prepared for this order
(g) Customer is given the bill
(h) Customer pays the bill
A sequence diagram for the scenario will have at least how many objects among whom the messages will be exchanged
- A.
3
- B.
4
- C.
5
- D.
6
Attempted by 257 students.
Show answer & explanation
Correct answer: C
Answer: At least 5 objects are required.
Reasoning:
Customer — initiates reading the menu, placing the order, requesting and paying the bill.
Menu (or ordering medium) — the menu is read by the customer and is the object representing available items.
Waiter/Server — receives the order from the customer and delivers requests to the kitchen and bill to the cashier or customer.
Kitchen — prepares the ordered items after receiving the order.
Cashier/Billing — prepares the bill and accepts payment.
Mapping the scenario steps to messages between these objects:
Customer -> Menu: reads the menu (represents the customer consulting available items).
Customer -> Waiter/Server: places the order.
Waiter/Server -> Kitchen: sends the order for preparation.
Kitchen -> Waiter/Server: notifies when items are ready; Waiter/Server -> Customer: serves the items.
Customer -> Waiter/Server: requests the bill.
Waiter/Server -> Cashier/Billing: asks to prepare the bill; Cashier/Billing -> Waiter/Server or Customer: provides the bill.
Customer -> Cashier/Billing: pays the bill.
These interactions show five distinct objects exchanging messages; additional objects could be added for more detail, but five is the minimal clear model for the given scenario.
A video solution is available for this question — log in and enroll to watch it.