Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

by java langusge image text in transcribed
image text in transcribed
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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How are gains or losses from biological assets recognized?

Answered: 1 week ago