Skip to content
Open
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
22 changes: 22 additions & 0 deletions Plane.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class Plane(Vehicle):
def __init__(self, make, model, capacity):
super().__init__(make, model) # Call the initializer of the parent class
self.capacity = capacity

def display_info(self):
super().display_info() # Call the parent method to display common info
print(f"Capacity: {self.capacity} passengers")

def take_off(self):
print(f"The {self.model} is now taking off.")

def land(self):
print(f"The {self.model} has landed safely.")

if __name__ == "__main__":
my_plane = Plane("Boeing", "747", 416)
my_plane.display_info()
my_plane.start()
my_plane.take_off()
my_plane.land()
my_plane.stop()