Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create 4 classes extending from a base Drink class. Directions in the attached .py file. Using python 3.x to solve this problem. #Given the following

image text in transcribed

Create 4 classes extending from a base Drink class. Directions in the attached .py file. Using python 3.x to solve this problem.

#Given the following Code: Eclass Drink (): def init (self, name, calories): se t . name name solf.empty calorics = calories/2 sell.healthy calories = calories/2 def drink (self): print("You drink "+self.name+" which provides:") print("In\t empty:"+str (self.empty calories)) print(" n\t healthy: "+str (self.healthy calories)) |# Write a Smoothie class that extends from Drink class # Override the nL function Lo only Lake calories and se L Lhe name to Smoo Lhe, #it should also distribute all the calories to healthy calories (Not half/half) # write a Soda class that extends from Drink class # Override the init function to only take calories and set the name to Soda, #it should also distribute all the calories to empty calories (Not half/half) # Write a DietSoda class that extends from Soda class # override the init function to not take any parameters, #but set the name to DietSoda and both calories to 0. # WrLe a VeganSmoo L hie class LhaL extends from Smoothie class # override the drink function so that it operates the same as before, #but adds a line to the end of the print: "and higher enlightenment

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

5. lind the arca of thc shaded region. (a) (0,0) 3 4 5 6 (b)

Answered: 1 week ago

Question

4. Evaluation is ongoing and used to improve the system.

Answered: 1 week ago

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago