Computer Science – 9.1 Computational Thinking Skills | e-Consult
9.1 Computational Thinking Skills (1 questions)
To model a library's book collection using abstraction, I would use classes to represent the key entities: Book, Member, and Loan. These classes would encapsulate the data and behavior associated with each entity. Relationships between these entities would be represented through the class definitions and methods.
Book Class:
- Data:** Title, Author, ISBN, Publication Year, Availability (boolean)
- Methods:**
isAvailable(),borrowBook(),returnBook()
Member Class:
- Data:** Member ID, Name, Address, Membership Type
- Methods:**
borrowBook(),returnBook(),checkFine()
Loan Class:
- Data:** Loan ID, Book (Book object), Member (Member object), Loan Date, Due Date, Return Date (can be null)
- Methods:**
calculateLateFee(),isOverdue(),recordReturn()
Diagram (Conceptual):
| Book | Member | Loan |
| Title, Author, ISBN, Availability | Member ID, Name, Address | Loan ID, Book, Member, Loan Date |
| isAvailable(), borrowBook(), returnBook() | borrowBook(), returnBook(), checkFine() | calculateLateFee(), isOverdue(), recordReturn() |
The relationships are modeled through object creation. For example, a Loan object would contain references to a Book object and a Member object. The methods within each class would encapsulate the logic for interacting with the entities and managing the relationships. This approach hides the internal details of how the library's data is stored and managed, providing a simplified interface for interacting with the system. For instance, a user wouldn't need to know how the book data is stored on disk; they would simply use the borrowBook() method to borrow a book.