From d2b313b95b3af2df01e9ec64a561214920d78414 Mon Sep 17 00:00:00 2001 From: Vincent Chen Date: Sat, 30 Nov 2024 14:51:05 -0500 Subject: [PATCH 1/2] Adding car class with updates --- Car.py | 4 ++++ 1 file changed, 4 insertions(+) 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 From 655ee7a27362a3fae56311e07e7613b46e2dd384 Mon Sep 17 00:00:00 2001 From: Vincent Chen Date: Sat, 30 Nov 2024 14:57:00 -0500 Subject: [PATCH 2/2] Van class as child class of Car --- Van.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Van.py 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}."