Bird
0
0

In designing a library system, which class should handle the logic to check if a book is currently loaned out before allowing a member to borrow it?

hard📝 Trade-off Q15 of 15
LLD - Design — Library Management System
In designing a library system, which class should handle the logic to check if a book is currently loaned out before allowing a member to borrow it?
ABook
BMember
CLoan
DLibrarian
Step-by-Step Solution
Solution:
  1. Step 1: Understand responsibilities of each class

    Book stores book info, Member represents users, Loan tracks borrow records, and Librarian manages library operations.
  2. Step 2: Identify who controls borrowing rules

    The Loan class should handle checking if a book is currently loaned out before allowing borrowing, as it tracks loan records.
  3. Final Answer:

    Loan -> Option C
  4. Quick Check:

    Loan class tracks loan status [OK]
Quick Trick: Loan class tracks if a book is loaned out [OK]
Common Mistakes:
MISTAKES
  • Putting borrowing logic inside Book class
  • Assigning loan status check to Member
  • Expecting Librarian class to enforce borrowing rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes