by java langege
Q2. 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 qty InStock 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. Sample output: What would you like to do? (1. Buy a book or 2. Exit): 1 These are the books available in our store: 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 Which book you would like to buy? 3 How many honky 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 qty InStock 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 Ilian $26.56 Then promote the user to make a choice. Use the sample output below to guide you. Sample output: What would you like to do? (1.Buy a book or 2. Exit): 1 These are the books available in our store: 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 Ilian $26.56 Which book you would like to buy? 3 How many books? 2 Sorry out of stock! What would you like to do? (1.Buy a book or 2. Exit): 1 These are the books available in our store: 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 ilian $26.56 Which book you would like to buy? 1 How many books? 1 What would you like to do? (1. Buy a book or 2. Exit): 2 Your total is $20.23 Thank you