Question: (Java) Write a class that will allow you to store information for the inventory in a BookStore. Private attributes: o The number of different books

(Java)

Write a class that will allow you to store information for the inventory in a BookStore.

Private attributes:

o The number of different books (distinct titles, not copies) in inventory

o An upper limit on the maximum number of titles

o An array of Book objects

The Constructor:

o Initialize the number of books to zero

o Initialize the maximum capacity to 10000

o Initialize the array of Books to size corresponding to the maximum capacity

Accessor method for the number of different titles

An addBook method that takes in a books title, price, and number in stock

o Add the information for this book into the array (look at how we added a new Card to the Deck in class)

A printInventory function that prints the information for all of the books in inventory.

A getBook function that takes in a title and returns the corresponding Book. If there is no book with that title, print an error message (and return null). Test your program:

Create a BookStore object

Add three books to your BookStore

Print the inventory

Look up a book by its title and print out its price.

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!