by java langusge
Ql. As of 2019 and according to searchenginejournal.com, Snapchat hit 203 million. Assuming its user base has been growing at a rate of 4.5% per month, and using the compound- growth technique you learned in the class (Fig. 5.6 in the slides) and assuming this growth rate continues, how many months will it take for Snapchat to grow its user base to 800 billion users? How many months will it take for Snapchat to grow its user base to 1.5 billion users? Write a program to show this. Sample output: Snapchat needs 32 months to reach 800 million users Snapchat needs 46 months to reach 1.5 billion users 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 S6.55 2. The glass castle by Jeannette Walls $5.55 3. Steve Jobs by Walter Isaacson S20.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 Four private instance variables: name (String), author (String), price (double), and qtyInStock (int). One constructor, which initializes all instances with the values given, except tyInStock, 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. Ifa 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.35 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 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