Question: Library.java: [YOU NEED TO CODE] The Library constructor will initialize an array of Book and Patron objects using the book and patron array parameters. The

 Library.java: [YOU NEED TO CODE] The Library constructor will initialize an

Library.java: [YOU NEED TO CODE]

The Library constructor will initialize an array of Book and Patron objects using the book and patron array parameters.

The checkin method will check in a book upon return. If the returned book belongs in the Library, and it is currently checked out, this method should update the status of the book, reset its patron and due date, determine the fine for this book (if any), and update the patron's balance. The return value indicates success or failure. For example, if the book is not in the library, checkin should return false.

The checkout method will let a patron checkout a book that is available in the Library. If the book belongs to the library and is available, this method will update it's status and patron, and set the due date to ten days from today's date. The return value indicates success or failure. For example, if the book is not in the library, checkout should return false.

The determineFine method will compute the fine currently due for a book that is checked out. For this method, the fine rate is $0.50 per day for each day after the due date.

The searchBooks method searches for books, depending on the key and type, and returns an array of the books found. If no books are found, the resulting array will have a length of zero.

When type is TITLE_SEARCH, key will be a string containing the title to search. The method should return all books with that title.

When type is AUTHOR_SEARCH, key will be a String containing the author's name. The method should return all books for that author.

When type is PATRON_SEARCH, key will either be a Patron object or an Integer with the Patron's id. The method should return all books checked out to that patron.

When type is OVERDUE_SEARCH, key will be a Date object. The method should return all books that will be overdue on that date (if not checked in before then).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!