Skip to main content

Exam FRQ: the toll booth

Challenge on lesson: Checkpoint: exam #1 FRQ

CHALLENGE
Difficulty: advanced+25 XP

45-minute FRQ section. Implement the TollBooth class: - constructor takes the toll amount (int cents) - pay(int paid) records a payment; returns the change due (paid - toll, floored at 0) - shortfall(int paid) returns toll - paid when paid is less than toll, else 0 - totalCollected() returns the sum of ALL toll amounts actually collected (min(paid, toll) per payment; reset by endDay()) - endDay() returns the day's total and resets it Implement the full class.

Back to lesson: Checkpoint: exam #1 FRQ