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
18 changes: 18 additions & 0 deletions Bus.py
Original file line number Diff line number Diff line change
@@ -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."
5 changes: 5 additions & 0 deletions Car.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"