diff --git a/Car.py b/Car.py index 9741b1f..74c06af 100644 --- a/Car.py +++ b/Car.py @@ -12,3 +12,15 @@ def display_info(self): def honk(self): """Specific implementation for a car.""" return "Honk honk!" +class ElectricCar(Car): + def __init__(self, brand, model, year, doors, battery_capacity): + super().__init__(brand, model, year, doors) + self.battery_capacity = battery_capacity + + def display_info(self): + """Override the display_info method to include battery information.""" + return f"Electric Car: {self._brand} {self._model}, {self.doors} doors ({self._year}) - Battery: {self.battery_capacity} kWh" + + def charge(self): + """New method specific to ElectricCar.""" + return "Charging the battery!"