diff --git a/Bus.py b/Bus.py new file mode 100644 index 0000000..6f6ed0a --- /dev/null +++ b/Bus.py @@ -0,0 +1,18 @@ +from Vehicle import Vehicle + +class Bus(Vehicle): + def __init__(self, brand, model, year, capacity): + super().__init__(brand, model, year) + self.capacity = capacity + + def display_info(self): + """Override the parent class method for a Bus.""" + return f"Bus: {self._brand} {self._model}, seats {self.capacity} passengers ({self._year})" + + def honk(self): + """Specific implementation for a bus.""" + return "Beep Beep! Make way for the bus!" + + def open_doors(self): + """Simulate opening the bus doors.""" + return "The bus doors are open." diff --git a/Car.py b/Car.py index 9741b1f..3e43300 100644 --- a/Car.py +++ b/Car.py @@ -12,3 +12,8 @@ def display_info(self): def honk(self): """Specific implementation for a car.""" return "Honk honk!" + + def start_engine(self): + """Simulate starting the engine of the car.""" + return f"{self._brand} {self._model}'s engine has started!" +