Drawer

Protein shake

Protein shake - student project

This is a program that tells you how much ingredients (protein powder and milk) you have left after making a protein shake.

 

 

Key OOP concepts used

 

Abstraction:  The user just has to interact with methods like make_shake(), without worrying about how the code works internally.

 

Encapsulation: Each class encapsulates its data. For example, the class Milk encapsulates cup_size and total_volume. And its behavior, in this case pour_cup.

 

Composition: A ProteinShake is composed of Milk and ProteinPowder.

 

Reusability: The Milk, ProteinPowder and ProteinShake classes can all be used in other programs.

 

I wanted to use a mixin where the protein powder is edible, then becomes drinkable after combining with the milk, but it didn't seem necessary.