Question
Taking into account the previous exercise, create also the Bookcase class (understood as a bookcase inside a bookstore). Each bookcase must be dedicated to a
Taking into account the previous exercise, create also the Bookcase class (understood as a bookcase inside a bookstore). Each bookcase must be dedicated to a certain literary genre included in the list of genres chosen in the previous exercise, and therefore must contain only books of the same genre. In the Bookcase class there must be a method called addBook (Book book), which allows you to add a book with the correct genre to the bookcase. Also create the Bookstore class. A bookstore must contain only one bookcase for each genre, and therefore it is necessary to prevent that two bookcases with the same genre can be added. Finally create a BookstoreTest class, which creates an object of type Bookstore adding to it objects of type Bookcase to which have been added objects of type Book. Verify that two bookcases with the same genre cannot be added to the bookstore.
Step by Step Solution
3.47 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
Based on the description provided heres an implementation of the Bookcase Bookstore and BookstoreTest classes in Java java import javautilHashMap impo...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started