Dispatch, inheritance, and composition

F-DISPATCH-V4-3hard

Undo a scan

First quote each selected desk plan for its rental months using that plan’s monthly price. Then reconcile the visitor badge count with both single and batch scans. Finally undo the last recorded transaction: a batch undo removes every badge in that batch, while a single undo removes one.

What needs to change

Repair CountingLog so the count follows every undo.

Reproduce

  1. Pipe the sample scans and undos into go run main.go and compare the badges line.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its imports, readLines, Log (which keeps each scan or batch as a group) and the complete main.

Input: up to 50 commands: "scan name", "batch name ..." with 1 to 10 batch names, or "undo". Ordinary spaces/tabs delimit fields; names are opaque tokens. Undo on empty history does nothing. The supplied reader receives valid data.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in