diff --git a/Car.py b/Car.py index 9741b1f..398a82e 100644 --- a/Car.py +++ b/Car.py @@ -12,3 +12,5 @@ def display_info(self): def honk(self): """Specific implementation for a car.""" return "Honk honk!" + def open_trunk(self): + return "Trunk is now open." \ No newline at end of file diff --git a/boat.py b/boat.py new file mode 100644 index 0000000..06bd0c2 --- /dev/null +++ b/boat.py @@ -0,0 +1,16 @@ +from Vehicle import Vehicle + +class Boat(Vehicle): + def __init__(self, brand, model, year, boat_type): + super().__init__(brand, model, year) + self.boat_type = boat_type + + def display_info(self): + """Override the parent class method for a Boat.""" + return f"Boat: {self._brand} {self._model}, Type: {self.boat_type} ({self._year})" + + def honk(self): + return "Honk!" + + def anchor(self): + return "Anchoring the boat." \ No newline at end of file