Question: Write a program intended to manage a library. Your program should create an interface for users to perform a series of operations, and define the
Write a program intended to manage a library. Your program should create an interface for users to
perform a series of operations, and define the following classes:
Book:
Contains two strings for a title and genre
Implements a parameterized constructor for setting the above
Implements a ToString method that will print only the title of the book
BookShelf:
Contains a character representing the first letter of the title of each book in this shelf
Contains an Arraylist of Books. This should contain a maximum of eight books
Implements a default constructor and gettersetters for the above
Implements a void method that will add a Book to this shelf if the Book's title begins with the
correct letter for the shelf. If the Book is not appropriate for this shelf, simply return
Implements a void method that will remove a Book from this shelf
Implements and overrides the ToString method, which will print each Book title in the shelf
on a single line. Each title should be separated by three spaces. If there are no books in the
shelf, print "Empty" instead.
LibraryTester:
Contains only a main method that performs the following:
Instantiate two different BookShelf objects, with bookshelf titles being OT
Print both BookShelf objects
Instantiate the following four Books
"The Heart of the Betrayed" Crime
"Our Hill of Stars" Fantasy
"One of a Kind" Science Fiction
"The Vision of Roses" Romance
Print each of these Books from top to bottom
Attempt to add each Book to both shelves
Print both BookShelf objects, starting with the BookShelf intended for book titles starting
with Othen
Expected output:
The Heart of the Betrayed
Our Hill of Stars
One of a Kind
The Vision of Roses
Our Hill of Stars One of a Kind
The Heart of the Betrayed The Vision of Roses
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
