diff --git a/Car.py b/Car.py index 9741b1f..f949501 100644 --- a/Car.py +++ b/Car.py @@ -12,3 +12,7 @@ def display_info(self): def honk(self): """Specific implementation for a car.""" return "Honk honk!" + + def refuel(self, amount): + """Refueling the car.""" + return f"Refueling {amount} liters of {self.fuel_type}." \ No newline at end of file diff --git a/Van.py b/Van.py new file mode 100644 index 0000000..c9759cd --- /dev/null +++ b/Van.py @@ -0,0 +1,17 @@ +from Vehicle import Vehicle + +class Van(Car): + def __init__(self, brand, model, year, doors, cargo_space): + super().__init__(brand, model, year, doors) + self.cargo_space = cargo_space # in cubic feet + + def display_info(self): + """Override the Car class method for a Van.""" + return ( + f"Van: {self._brand} {self._model}, {self.doors} doors " + f"({self._year}), Cargo Space: {self.cargo_space} cubic feet" + ) + + def load_cargo(self, weight): + """Loading cargo into the van.""" + return f"Loading {weight} lbs of cargo into the {self._brand} {self._model}."