This question deals with Java class design. \
First, read the following description of an online shopping system for books:
The online system sells a range of books. Every book in the system has a unique
identifier (a positive integer), a price (represented as a real number), along with
strings representing its title, author, and publisher. In addition, every book has
an integer property representing the number of copies of that book in stock; if
the number is zero, then the book is out of stock, otherwise it is available.
Users can put books into an online shopping basket. For simplicity, we will assume that a user will only put a single copy of each book into the basket. The
shopping basket provides only the ability to add a book to the basket; at this time,
there is no support for removing a book. A book is only added to the basket if it
is (i) not already in the basket and (ii) not out of stock.
(a) Write a class definition for Book, incorporating all of the attributes mentioned above. You
should also define a public constructor for Book, which should initialise all instance fields to sensible values. The constructor should assign a unique identifier value to each instance.
You do not need to define any instance methods.
(b) Write a class definition for ShoppingBasket, incorporating the book-adding functionality mentioned above. You may assume that the Book class provides any necessary get/set methods. If one of the conditions for adding a book to the basket is violated, your implementation
should throw an IllegalArgumentException instead of adding it.
(c) Imagine that the shopping system is to be expanded to sell CDs in addition to books. Describe how you would modify the classes defined above to deal with this situation. You may
illustrate your answer with fragments of Java source code, but this is not essential
What I have tried:
Do I need to use Scanner and explain about instance variable and method declaration here in this case