The challenge
A department library tracks issues on paper. Build a console system that stores books and members, handles issues, returns and fines, and searches quickly.
The point is not the menu screens; it is choosing the right data structure for each operation and proving the choice with measurements.
Learning sequence
Phase 1
Model the domain
Classes for books, members and loans, with clear ownership and constructors.
Phase 2
Choose storage
Hash maps for lookup by ID, a sorted index for title search; write down why.
Phase 3
Business rules and tests
Issue limits, due dates and fines, each covered by unit tests including edge cases.
Phase 4
Measure and explain
Time searches at 1k, 10k and 100k records and relate the numbers to complexity.
What students hand in
- C++ source in a Git repository with meaningful commits
- Unit tests for edge conditions
- One-page complexity note with measurements
Skills practised
- OOP in C++
- Hash maps and ordered maps
- Unit testing
- Big-O reasoning
Assessment rubric
Shared with students on day one. Weights are set with the department to match internal assessment.
| Criterion | What good looks like |
|---|---|
| Correctness | Passes hidden test cases for issue, return, fines and search. |
| Data structure choice | Each structure is justified by the operations it serves. |
| Code quality | Readable names, small functions, steady commit history. |
| Explanation | Can explain the complexity note without reading from it. |
Stretch goals for faster teams
- Persist records to a file and reload safely
- Add a reservation queue for popular titles