Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

ChewingGum.java

/** * 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; }

}

Chocolate.java

/** * 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, int kcal, String mixIn) { super(name, kcal); this.mixIn = mixIn; } }

(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. Ex: 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: 218 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 Flavor: Orange Enter the Candy Calories: 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 @ 18 - 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

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

Effective Delivery Effective

Answered: 1 week ago