Update page 'Day 4 homework - Sloetjes'

xuanyi.wang
2023-04-04 20:34:05 +02:00
parent dba6fc3a01
commit e875774c94
+2 -2
@@ -29,7 +29,7 @@ Design two versions of this object with the following shared criteria:
**1. One version of the object should be very simple, such as the hot dog example.** **1. One version of the object should be very simple, such as the hot dog example.**
##### The Simple Version of Water Bottle Object: ###### The Simple Version of Water Bottle Object:
``` ```
class WaterBottle: class WaterBottle:
@@ -58,7 +58,7 @@ class WaterBottle:
**2. The other version of the object should be overly complicated, with verbs such as `weigh` to get its mass, `mood` to get its mood, `price_tag` to have it return its estimated value, and `go_to_moon` to send the object to the moon (in the case of the pet, it would probably explode and `use()` should return `False`). Try to define at least 20 different verbs you could use on the object, with associated instance variables to track its state so the verbs interact correctly. For example, a `throw` verb on a hot dog should reduce its mass, because some of its condiments will end up on the target.** **2. The other version of the object should be overly complicated, with verbs such as `weigh` to get its mass, `mood` to get its mood, `price_tag` to have it return its estimated value, and `go_to_moon` to send the object to the moon (in the case of the pet, it would probably explode and `use()` should return `False`). Try to define at least 20 different verbs you could use on the object, with associated instance variables to track its state so the verbs interact correctly. For example, a `throw` verb on a hot dog should reduce its mass, because some of its condiments will end up on the target.**
##### The complicated version of Water Bottle Object: ###### The complicated version of Water Bottle Object:
``` ```
class WaterBottle: class WaterBottle:
def __init__(self, max_uses): def __init__(self, max_uses):