References, pointers, and handles

F-REF-V4-3hard

Keep tags on their tubs

Repair the stock-record editor: apply deliveries to the retained records, locate an exact requested name-and-quantity value, then maintain durable IDs across removal, sale and insertion.

What needs to change

Repair run so every tag stays on its own tub.

Reproduce

  1. Pipe the sample commands into go run main.go and compare the tag lines and the final stall.

Acceptance criteria

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

Notes

The file contains its imports, readLines, the Tub type and the complete main.

Input: up to 100 commands: "add NAME KG", "sell TAG KG" or "remove TAG". Names are single words, KG is a whole number from 0 to 100 and TAG is a positive integer up to 100. Sales may leave a negative recorded balance. Unknown tags are ignored; 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