PYTHON PROGRAMMING 1) Create a class Drink with the attribute size. 2) Create a Drink print method that prints the size in ounces. 3) Create a class Soda which inherits from Drink. 4) Soda has an attribute sugar. 5) In Soda override the Drink print method to also print sugar in grams. 6) Instantiate two objects, one of type Drink and one of type Soda. 7) Call the print functions for each object. Example Output Size: 12 ounces Size: 12 ounces  Sugar: 36 grams

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 5E
icon
Related questions
Question
100%

PYTHON PROGRAMMING

1) Create a class Drink with the attribute size.
2) Create a Drink print method that prints the size in ounces.
3) Create a class Soda which inherits from Drink.
4) Soda has an attribute sugar.
5) In Soda override the Drink print method to also print sugar in grams.
6) Instantiate two objects, one of type Drink and one of type Soda.
7) Call the print functions for each object.


Example Output
Size: 12 ounces
Size: 12 ounces  Sugar: 36 grams

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Data members
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr