Skip to main content

Master FRQ: the clinic scheduler

Challenge on lesson: Checkpoint: the master FRQ

CHALLENGE
Difficulty: advanced+25 XP

25-minute FRQ. Implement the Clinic class (four behaviors, no topic announced): - constructor takes the number of rooms - arrive(String patient) adds the patient to the waitlist unless already waiting (returns true on success, false on duplicate) - room() assigns the waitlisted patient at the FRONT to a free room if any exist (rooms are slots, like lockers; returns the 1-based room number or -1) — the patient leaves the waitlist - waiting() reports the waitlist size - freeRooms() reports unoccupied room count Implement the full class. Bank order: arrive, waiting/freeRooms, then room.

Back to lesson: Checkpoint: the master FRQ