This program models a library that allows user to search its inventory of books based on keywords (i.e., any words that match any in the book's author or title). This can be seen as a small step towards building something like amazon.com
There are several classes as part of this project, but the two classes you will work with are Book and Library. Complete the following exercises in order to make the library program functional.
initializein the class
Librarysuch that it creates a
Bookobject based on the data in a file of book information and then adds it to the library's inventory by calling the method
insertBook. The format of the book data in the file is such that each book is represented by three lines: the title, the author, and the year.
equalsin the class
Booksuch that it returns true only if both books have the exact same title and author, and false otherwise.
insertBookin the class
Libraryworks. To help your explanation, draw a picture of the instance variable
myInventoryand show how it is updated in both the true and false cases of the conditional after each call made using this example data.
findWordInin the class
Booksuch that it returns true if any whole word in original matches keyword, and false otherwise. For example, if one of the keywords is "love", then it should not match the word "glove" because it is a different word that just happens to contain the keyword as part of it. Note, you do not need to worry about punctuation when comparing words.
findBooksin the class
Librarysuch that it returns a list of all books in the inventory that match the given keywords (i.e., by calling the
matchesin the class
Bookworks. Give some test cases that would effectively check that this method works correctly.