Audit every line
A café till quotes prices for members and guests, audits order lines and keeps an account balance.
What needs to change
Repair accept so every line is audited while preserving the positive-amount acceptance rule.
Reproduce
- Run go run main.go using Sample lines as stdin; compare the accepted item lines and the final audit count.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The supplied main.go contains the reader, audit and caller. audit records one nonempty item and returns true; it is correct. Input has one nonempty item and a whole-unit amount from -100 to 100 per line. At most 100 valid lines are supplied.
The till must retain an audit entry for rejected as well as accepted submissions. A positive amount is accepted; the other amounts are not. The reader does not validate these supplied-data bounds.