Question: Create a class called Book that contains: Four private instance variables: name (String), author (String), price (double), and qtyInStock (int). One constructor, which initializes all

Create a class called Book that contains:
Four private instance variables: name (String), author (String), price (double), and qtyInStock (int).
One constructor, which initializes all instances with the values given, except qtyInStock, assume all qtyInStock are equal to 2 for all given books.
Methods getters and setters for all the instance variables
Write a test program called TestBook to test the constructor and public methods in the class Book. Allow the user to inquire about books and buy books until exit is chosen. If a book is bought you need to modify the quantity available form that book. In your main you should first create 4 books as follows:
1. Big Magic by Elizabeth Gilbert $6.55
2. The glass castle by Jeannette Walls $5.55
3. Steve Jobs by Walter Isaacson $20.23
4. Bill Gates by George llian $26.56
Then promote the user to make a choice. Use the sample output below to guide you.

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!