# This is from this f19's recitation.
# Write the classes required to pass these tests:
def testCakeClasses():
cake = Cake("Vanilla")
print(str(cake)) # "Vanilla Cake"
# you can add unlimited toppings to cakes
for i in range(3):
cake.addTopping("Almonds")
print(cake.toppings) # ["Almonds", "Almonds", "Almonds"]
appleFruitCake = FruitCake("Apple")
print(isinstance(appleFruitCake, Cake)) # True
appleFruitCake.addTopping("Peanut Butter")
appleFruitCake.addTopping("Ranch") # yum
print(appleFruitCake.toppings) # ["Peanut Butter", "Ranch"]
# You can only add 2 toppings to a fruitcake
appleFruitCake.addTopping("Tomatoes")
print(appleFruitCake.toppings) # ["Peanut Butter", "Ranch"]
print(str(appleFruitCake)) # "no one likes Apple fruitcakes"
blackForestCake = YummyCake("Chocolate", "Vanilla") # cakes aren't yummy without frosting!
print(isinstance(blackForestCake, Cake)) # True
print(isinstance(blackForestCake, FruitCake)) # False
print(str(blackForestCake)) # "Chocolate YummyCake with Vanilla frosting"
# you can add unlimited toppings to yummy cakes
for i in range(69):
blackForestCake.addTopping("Cherry")
print(blackForestCake.toppings) # ["Cherry"]*69
print(blackForestCake == YummyCake("Chocolate", "Vanilla")) # True
print(blackForestCake == YummyCake("Vanilla", "Chocolate")) # False
print(blackForestCake == appleFruitCake) # False
print(blackForestCake == "sign up for hack112!!") # False
# YummyCake class keeps track of what cakes combos have been made
carrotCake = YummyCake("Carrot", "Cream Cheese")
print(YummyCake.hasUsedFlavorCombo("Carrot", "Cream Cheese")) # True
print(YummyCake.hasUsedFlavorCombo("Carrot", "Vanilla")) # False
superCarrotCake = YummyCake("Carrot", "Cream Cheese")
superCarrotCake.addTopping("Sprinkles") # perfection
testCakeClasses()