Reject the whole order
A café ordering tool parses quantities, looks up prices and totals each table’s order.
What needs to change
Repair order_total so any unreadable quantity rejects the whole order.
Reproduce
- Run rustc --edition=2024 main.rs -o main && ./main with the two-order sample, then compare the table2 line with the expected stdout.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The file contains its use declarations, read_rows, order_total and main.
Input: up to50 records, one opaque UTF-8 table token followed by zero or more quantity tokens per LF/CRLF line, with ASCII space/tab fields and framing. Tokens exclude field separators and CR/LF. Quantities use Rust u32 parsing, including optional+ and leading zeros; malformed and out-of-range words are valid rejection inputs. The sum of individually accepted quantities in each record fits u32, even when another word is invalid.