Prompt the user (the shopkeeper) to enter the name, type, price and burn time for each of the three different types of candles, types 1, 2, and 3. Once you have this information, instantiate three Candle objects, one for each type using the information the user provided. This step can be considered the store setup. Assume a customer wants to make a purchase. Prompt the user to enter the number of candles of each type the customer wants to buy. Since you can’t buy a fraction of a candle, the number bought for each type of candle must be an integer. (You may assume that only integer values between 0 and 10 will be entered when this program is tested.) Calculate the total price of all the candles bought using the information provided in step 1 and by calling the appropriate getter to find out the price of each type of candle. The shop owner wants to offer a discount based on the total purchase price. Deduct this discount from the purchase price. If the price is more than $20 but $35 or less they receive a 5% discount. If the price is more than $35 but $55 or less they receive a 7% discount. If the price is more than $55 but $100 or less they receive a 10% discount If the price is more than $100 they receive a 20% discount. Calculate the total burn time of all the candles if they were burned consecutively (i.e., one after the other). Again, use the appropriate getter of the Candle class to determine the individual burn time. Calculate the total cost-per-minute for that purchase using the discounted purchase price and the total burn time. Output some kind of meaningful display that includes the number of candles of each type bought, their name and type, the total price (before and after discount if applied), the total burn time, and the cost-per-minute to burn all the candles all the way down. You can be as creative as you want with this! Once you have a working solution, you can begin to use loops to create a histogram of stars that show the breakdown of the different candle types and the total number of candles purchased. The following class file has to be used and unaltered if possible class Candle {     private String name;     private int type;     private double cost;     private int burnTime;     public Candle(String nam, int typ, double cst, int brn) {       this.name = nam;       this.type = typ;       this.cost = cst;       this.burnTime = brn;     }     public String getName() {       return this.name;     }     public void setName(String nam) {       this.name = nam;     }     public int getType() {       return this.type;     }     public void getType(int typ) {       this.type = typ;     }     public double getCost() {       return this.cost;     }     public void setCost(double amount) {       this.cost = amount;     }     public int getTime() {       return this.burnTime;     }     public void setTime(int minutes) {       this.burnTime = minutes;     } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
  1. Prompt the user (the shopkeeper) to enter the name, type, price and burn time for each of the three different types of candles, types 1, 2, and 3. Once you have this information, instantiate three Candle objects, one for each type using the information the user provided. This step can be considered the store setup.
  2. Assume a customer wants to make a purchase. Prompt the user to enter the number of candles of each type the customer wants to buy. Since you can’t buy a fraction of a candle, the number bought for each type of candle must be an integer. (You may assume that only integer values between 0 and 10 will be entered when this program is tested.)
  3. Calculate the total price of all the candles bought using the information provided in step 1 and by calling the appropriate getter to find out the price of each type of candle.
  4. The shop owner wants to offer a discount based on the total purchase price. Deduct this discount from the purchase price.
    1. If the price is more than $20 but $35 or less they receive a 5% discount.
    2. If the price is more than $35 but $55 or less they receive a 7% discount.
    3. If the price is more than $55 but $100 or less they receive a 10% discount
    4. If the price is more than $100 they receive a 20% discount.
  5. Calculate the total burn time of all the candles if they were burned consecutively (i.e., one after the other). Again, use the appropriate getter of the Candle class to determine the individual burn time.
  6. Calculate the total cost-per-minute for that purchase using the discounted purchase price and the total burn time.
  7. Output some kind of meaningful display that includes the number of candles of each type bought, their name and type, the total price (before and after discount if applied), the total burn time, and the cost-per-minute to burn all the candles all the way down. You can be as creative as you want with this!
  8. Once you have a working solution, you can begin to use loops to create a histogram of stars that show the breakdown of the different candle types and the total number of candles purchased.
  9. The following class file has to be used and unaltered if possible
  10. class Candle {
        private String name;
        private int type;
        private double cost;
        private int burnTime;
        public Candle(String nam, int typ, double cst, int brn) {
          this.name = nam;
          this.type = typ;
          this.cost = cst;
          this.burnTime = brn;
        }
        public String getName() {
          return this.name;
        }
        public void setName(String nam) {
          this.name = nam;
        }
        public int getType() {
          return this.type;
        }
        public void getType(int typ) {
          this.type = typ;
        }
        public double getCost() {
          return this.cost;
        }
        public void setCost(double amount) {
          this.cost = amount;
        }
        public int getTime() {
          return this.burnTime;
        }
        public void setTime(int minutes) {
          this.burnTime = minutes;
        }
    }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education