Change the balance once
A café till quotes prices for members and guests, audits order lines and keeps an account balance.
What needs to change
Repair main so each line changes the balance once.
Reproduce
- Run go run main.go using Sample day as stdin; compare each updated balance and overdraft notice.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The supplied main.go contains the reader and apply. apply is correct: one call changes the account and returns its new balance. Input is deposit or spend and a nonnegative whole-unit amount from 0 to 100. At most 100 valid lines are supplied, so a correct balance stays between -10000 and 10000.
Print the updated balance for each line, followed immediately by overdrawn when that new balance is below zero. These are supplied valid inputs, not a validation task.