Create a class to represent a Book. A Book should have a title, author, edition, and number of pages. Choose the most appropriate types for each of these and make them private. Provide set and get methods for each of the instance variables. Also, create a toString() method that returns a String of the form:
Title: ____, Author: ____, Edition: ____, Number of pages: ____.
Create a class that represents a Shelf that contains an array of Books. Have the constructor for Shelf, take in a number that represents how many books will be in the array. Have a method that takes in a Book object and an index at which to store it in the array of Books.
Create another class that has a main method that asks the user how many books will be stored on the shelf and then instantiates an object of type Shelf. Then ask the user for the title, author, edition and number of pages for each of those books and store them in the object of type Shelf.
Finally, repeatedly show a menu like this (until they choose 3):
- Search for a book by title.
- Search for books by author.
- Quit
That when the user chooses option 1, they should be asked for the title of a book and that
book title should be checked against all the book title on the shelf and report back (print) whether the book is on the shelf or not.
When the user chooses option 2, they should be asked for an author's name. Your code should then search the shelf's books by author and display ALL the books that have that author's name or else reports back that no books by that author are on the shelf.