Dispatch, inheritance, and composition

F-DISPATCH-V4-2medium

Count the badges

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 every badge is counted once.

Reproduce

  1. Pipe the sample scans 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 and the complete main.

Input: up to 50 commands, each "scan name" or "batch name ..." with 1 to 10 batch names. Ordinary spaces/tabs delimit fields. Names are opaque nonempty tokens, including numeric-looking labels. 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