This question evaluates queue and priority handling, stable ordering, capacity accounting, constraint handling for wheelchair riders, and the ability to design unit tests and articulate trade-offs within the Software Engineering Fundamentals category.
You are implementing a simplified bus boarding simulator.
Model:
Person
has at least:
id
(string/int)
priority
(boolean): if true, they should board before non-priority riders.
wheelchair
(optional): if present, the person uses a wheelchair.
capacityCost
(int): how many capacity units they consume when boarding (defaults to 1 for a normal rider; wheelchair riders may have different costs).
Bus
has:
totalCapacity
(int)
maxWheelchairs = 2
Task A — Priority boarding:
Task B — Explain tradeoffs:
Task C — Unit tests:
Task D — Add wheelchair constraints:
capacityCost
units (not necessarily 1).
You may define your own function signatures (e.g., board(bus, waitingQueue)).