Answered step by step
Verified Expert Solution
Question
1 Approved Answer
It C++ 2.1 Three Candies Written for you is a Candy class and a Chocolate sub-class (of Candy). You should add two more subclasses, for
It C++
2.1 Three Candies Written for you is a Candy class and a Chocolate sub-class (of Candy). You should add two more subclasses, for SoftCandy and HardCandy. HardCandy has a property (member variable for transparency, SoftCandy has a property of flavor. Adjust the constructor of each to ask for these just like Chocolate's percent property). Also set up dot-h files and destructors. The test code just creates and destroys a candy (one test for each of the 3 sub-types) LAB ACTIVITY 2.1.1: Three Candies 0/3 Current file: main.cpp Load default template... 1 /I ThreeCandies 2 // lab for ITP-165 3 // Nathan and Ray and Barry 2018, 2019 4/*It asks the use for a type of candy, then asks for 5 information about that candy (some of which is for 6 all candies, some for just this type Display info 7 and then destruct - should see the destructor in two 8 stages (the sub-type of candy first, then Candy) 10 1* 11 Choose from one of the following: 12 1. Chocolate 13 2. Hard Candy 14 3. Soft Candy 15 Please Choose: 16 1 17 Name: 18 Hershey Bar 19 Calories 20 250 41 Name: Life Savers 42 calories: 18 43 Transparency: 85 44 Destroying Hard Candy 45 Destroying candy! 46 47 Choose from one of the following: 481. Chocolate 49 2. Hard Candy 50 3. Soft Candy 51 Please Choose: 52 3 53 Name: 54 Gumdrops 55 Calories: 56 35 57 Flavor 58 lemon 59 Name: Gumdrops 60 calories: 35 61 Flavor: 1emon 62 Destroying Soft Candy 63 Destroying candy! 64. 65 66 / 67 68 //#include "stdafx.h" 69 #1 nclude "chocolate . h" 70 #include "HardCandy.h" 71 #include "SoftCandy.h" 72 73 #includedstream 74 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started