Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Car.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}."
17 changes: 17 additions & 0 deletions Van.py
Original file line number Diff line number Diff line change
@@ -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}."