From 36f36649b877beabb0d10092bff47cba9a56cdf5 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 30 Jun 2022 15:13:22 -0500 Subject: [PATCH] saving added classes : ' --- fleet.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/fleet.py b/fleet.py index 23393c4..4c03c96 100644 --- a/fleet.py +++ b/fleet.py @@ -57,18 +57,26 @@ class GroundVehicle(Vehicle, GroundVehicleInterface): # default value set to true. Many ground vehicles will have trailers or train cars. Modified as needed self.isModular = True self.moveGroundVehicle = float(input()) + +class RoadVehicle(GroundVehicle): + + @abstractmethod + def __init__(self, _axlecount): + self.axleCount = _axlecount class Train(GroundVehicle): - def __init__(self, noOfCarsAttached, locomotiveCount): - self.noOfCarsAttached = 1 - self.locomotiveCount = 1 + def __init__(self, _noOfCarsAttached, _locomotiveCount): + self.noOfCarsAttached = _noOfCarsAttached + self.locomotiveCount = _locomotiveCount def displayCarCount(self): print(self.noOfCarsAttached) - + def displayLocomotiveCount(self): + print(self.locomotiveCount) def travel(self): print("Speed 60mph, Direction E") Train1 = Train(20, 2) -Train1.displayCarCount() \ No newline at end of file +Train1.displayCarCount() +Train1.displayLocomotiveCount() \ No newline at end of file