Answered step by step
Verified Expert Solution
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
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 enlightenmentStep 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