Question: ET580, Quiz 3, Fall 2021 Submission detail: A) Submit cpp file for each question with given main function. B) points distribution: 50% compilation, 50% correctness.

 ET580, Quiz 3, Fall 2021 Submission detail: A) Submit cpp filefor each question with given main function. B) points distribution: 50% compilation,

ET580, Quiz 3, Fall 2021 Submission detail: A) Submit cpp file for each question with given main function. B) points distribution: 50% compilation, 50% correctness. Q1: Define a class named Beverage Private Data Member: name - type string pointer (dynamic variable) Appropriate accessor and mutator functions. Default constructor and one argument constructor. Define virtual output function. Define a class named Soda derived from Beverage Private Data Member: price - type double pointer (dynamic variable) Appropriate accessor and mutator functions Default constructor and two argument constructor. Define output function. Define a class named Beer driven from Beverage Private Data Member: alcohol_percentage - type double pointer (dynamic variable) Appropriate accessor and mutator functions. Default constructor and two argument constructor. Define output function. Use following main() to test your class. int main() { Beverage a("water"); a.output(); // print "Name: water" a.setName("Tea"); a.output(); // print "Name: Tea" Soda b("Gatorade", 1.99); b.output(); // print "Name: Gatorade, Price: 1.99" b.setName("Coke"); b.setPrice(2.99); b.output(); // print "Name: Coke, Price: 2.99" Beer c("Budweiser", 3.6); c.output(); // print "Name: Budweiser, Alcohol Percentage: 3.6" c.setName("Cools Light"); c.setAlcoholPercentage(4.2); c.output(); // print "Name: Cools Light, Alcohol Percentage: 4.2"ET580, Quiz 3, Fall 2021 Name: water Name: Tea Name: Gatorade, Price: 1.99 Name: Coke, Price: 2.99 Name: Budweiser, Alcohol Percentage: 3.6 Name: Cools Light, Alcohol Percentage: 4.2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!