Model a real system
A community library lends books to members. You'll model it with classes: books that know whether they're out, members with a borrowing limit, and a library that ties it together — with private data and clear errors.
The design
- Book(title) — isOut getter.
- Library — keeps books in a private Map by title, and loans by member name.
- lend(title, member) — throws if the book is missing, already out, or the member has 2 books.
- giveBack(title) — returns the book.