From 201bd6d0e5df3be8d3fdf4f8b1d3f00185f5d3b0 Mon Sep 17 00:00:00 2001 From: Yehor Tereshchenko <123106244+Yegmina@users.noreply.github.com> Date: Sun, 31 Aug 2025 22:34:48 +0300 Subject: [PATCH] Update 2.3_Association.md --- 2.3_Association.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/2.3_Association.md b/2.3_Association.md index 347afe8..9183eaf 100644 --- a/2.3_Association.md +++ b/2.3_Association.md @@ -264,19 +264,22 @@ Books by Author "Jane Doe": Title: "Data Structures and Algorithms", Year: 2018 ``` -**Task 2: Book Borrowing System** +--- -Enhance the `Library` class to include a book borrowing system. Add the following methods: +## Task 2: Book Availability Check -- `borrowBook(String title)`: This method should simulate a book being borrowed. It should remove the book from the library's collection if available. +Enhance the `Library` class by adding a method to check the availability of a specific book by its title. -- `returnBook(Book book)`: This method should simulate a book being returned to the library. It should add the book back to the library's collection. +- `isBookAvailable(String title)`: This method should return a `boolean` indicating whether the book with the specified title is available in the library. -**Task 3: Book Availability Check** +--- -Add a method to the `Library` class to check the availability of a specific book by its title: +## Task 3: Book Borrowing System -- `isBookAvailable(String title)`: This method should return a boolean indicating whether the book with the specified title is available in the library. +Further enhance the `Library` class to include a book borrowing system. + +- `borrowBook(String title)`: This method should simulate a book being borrowed. It should remove the book from the library's collection if it is available. **(Hint: You can use your `isBookAvailable` method from Task 2 to check this first!)** +- `returnBook(Book book)`: This method should simulate a book being returned. It should add the book back to the library's collection. **Task 4: Book Ratings and Reviews**