Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code: /** * Chocolate * Chocolate is made with CoCoa beans and milk. It is oftentimes mixed with a lot of other ingredients. * Examples:

image text in transcribed

image text in transcribed

Code:

/** * Chocolate * Chocolate is made with CoCoa beans and milk. It is oftentimes mixed with a lot of other ingredients. * Examples: Milka, Hershey, Snickers, Butterfinger, M&Ms, Kit Kat, Chocolate Covered Raisins, ... */

public class Chocolate extends CandyPiece { private String mixIn; public Chocolate(String name, intkcal, String mixIn) { super(name, kcal); this.mixIn = mixIn; } }

Code:

/** * Chewing Gums * Chewing gum (or gum, bubblegum) is a chewy candy. Some are easy to blow bubbles with. * Examples: Wrigley's Chewing Gum, Hubba-Bubba */

public class ChewingGum extends CandyPiece { private String flavor;

publicChewingGum(String name, intkcal, String flavor) { super(name, kcal); this.flavor = flavor; }

}

Code:

public class Candy {

public Candy() { }

}

(1) Create files to submit: Main.java -Contains main() method Candy.java Candy Piece.java Chewing Gum.java . Chocolate java (2) You are getting ready to keep track of Halloween candy consumption. Specifically, you are to keep track of calories as you eat the candy after you went door-to-door. How many candy do you have? Candy 1 Enter the type of Candy: Chocolate Enter the Candy name: Kit Kat Enter the Mix-in: Nuts Enter the Candy Calories: 219 Enter the item quantity: Candy 2 Enter the type of Candy: Chocolate Enter the Candy name: Butter Finger Enter the Mix-in: Marbles Enter the Candy Calories: 275 Enter the item quantity: Candy 3 Enter the type of Candy: chewing gum Enter the Candy name: Trident Enter the Plavor: Orange Enter the Candy Calories: 18 Enter the item quantity: (3)Add the calories of the items together and output the individual and total calories. Total Calories: Kit Kat 2 @ 218 = 436 Butter Finger 1 275 - 275 Trident 5 @ 19 - 90 Total: 801 calories (1) Create files to submit: Main.java -Contains main() method Candy.java Candy Piece.java Chewing Gum.java . Chocolate java (2) You are getting ready to keep track of Halloween candy consumption. Specifically, you are to keep track of calories as you eat the candy after you went door-to-door. How many candy do you have? Candy 1 Enter the type of Candy: Chocolate Enter the Candy name: Kit Kat Enter the Mix-in: Nuts Enter the Candy Calories: 219 Enter the item quantity: Candy 2 Enter the type of Candy: Chocolate Enter the Candy name: Butter Finger Enter the Mix-in: Marbles Enter the Candy Calories: 275 Enter the item quantity: Candy 3 Enter the type of Candy: chewing gum Enter the Candy name: Trident Enter the Plavor: Orange Enter the Candy Calories: 18 Enter the item quantity: (3)Add the calories of the items together and output the individual and total calories. Total Calories: Kit Kat 2 @ 218 = 436 Butter Finger 1 275 - 275 Trident 5 @ 19 - 90 Total: 801 calories

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

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago