From 36f36649b877beabb0d10092bff47cba9a56cdf5 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 30 Jun 2022 15:13:22 -0500 Subject: [PATCH 01/11] 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 -- 2.47.3 From 5ea0c7986026780453a350d24e0cbfae89a7f363 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Fri, 1 Jul 2022 11:54:29 -0500 Subject: [PATCH 02/11] saving further inheiritance work --- fleet.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fleet.py b/fleet.py index 4c03c96..5c6bb94 100644 --- a/fleet.py +++ b/fleet.py @@ -1,4 +1,5 @@ from abc import ABC, abstractmethod +# ABC is imported from the standard library since Python does not natively support abstract methods and classes. class Fleet(): vehicles = ["7E19H2", "N9460G32581A3", "BN4681"] @@ -44,7 +45,7 @@ class Vehicle(ABC): self.weight = 0 class GroundVehicleInterface(ABC): - '''Resource on Python interfaces. This is duck typed. https://realpython.com/python-interface/''' + '''Resource on Python interfaces. This is duck typed. https://realpython.com/python-interface/ Interfaces make a contract that a method must be implemented if an interface is inherited and allows differing implementations of the same method.''' @abstractmethod def travel(self): Vehicle.velocity = self.moveGroundVehicle @@ -79,4 +80,16 @@ class Train(GroundVehicle): Train1 = Train(20, 2) Train1.displayCarCount() -Train1.displayLocomotiveCount() \ No newline at end of file +Train1.displayLocomotiveCount() + +# At this point, my code should print out the values from the car count and the locomotive count. Further demonstration of abstract and concrete classes to follow + +class semi_Truck(GroundVehicle): + def __init__(self, _noOfTrailersAttached): + self.noOfTrailersAttached = _noOfTrailersAttached + def displayNoOfTrailersAttached(self): + print(self.noOfTrailersAttached) + +Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached.") + +semi_Truck.displayNoOfTrailersAttached() \ No newline at end of file -- 2.47.3 From ebb249f595db115cb3cf7e726d5237f216c33ccb Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Fri, 1 Jul 2022 12:04:35 -0500 Subject: [PATCH 03/11] saving work on further inheritance practice --- fleet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fleet.py b/fleet.py index 5c6bb94..c785033 100644 --- a/fleet.py +++ b/fleet.py @@ -89,7 +89,10 @@ class semi_Truck(GroundVehicle): self.noOfTrailersAttached = _noOfTrailersAttached def displayNoOfTrailersAttached(self): print(self.noOfTrailersAttached) + def travel(self): + print("Currently unloading") Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached.") -semi_Truck.displayNoOfTrailersAttached() \ No newline at end of file +# Remember to be careful to check that you are running the method on an instance of the class, not on the class definition. +Semi_Truck1.displayNoOfTrailersAttached() \ No newline at end of file -- 2.47.3 From f684cacb2f6a5d135a08245f76fd248e84538653 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Wed, 6 Jul 2022 13:54:21 -0500 Subject: [PATCH 04/11] saving progress on implementing abstracted methods --- fleet.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/fleet.py b/fleet.py index c785033..6d70996 100644 --- a/fleet.py +++ b/fleet.py @@ -36,23 +36,24 @@ class Vehicle(ABC): # https://www.geeksforgeeks.org/inheritance-and-composition-in-python/ @abstractmethod - def __init__(self, gpsPosition, velocity, weight, velocityType, weightType): + def __init__(self, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): self.vehicleObject = Fleet() - self.gpsPosition = [0,0] - self.velocity = 0 - self.velocityType = "kph" - self.weightType = "kg" - self.weight = 0 + self.gpsPosition = _gpsPosition + self.velocity = _velocity + self.velocityType = _weight + self.weightType = _velocityType + self.weight = _weightType + self.status = _status class GroundVehicleInterface(ABC): '''Resource on Python interfaces. This is duck typed. https://realpython.com/python-interface/ Interfaces make a contract that a method must be implemented if an interface is inherited and allows differing implementations of the same method.''' @abstractmethod def travel(self): Vehicle.velocity = self.moveGroundVehicle + print("Traveling") class GroundVehicle(Vehicle, GroundVehicleInterface): - @abstractmethod def __init__(self, volume): # default value set to true. Many ground vehicles will have trailers or train cars. Modified as needed @@ -82,17 +83,22 @@ Train1 = Train(20, 2) Train1.displayCarCount() Train1.displayLocomotiveCount() -# At this point, my code should print out the values from the car count and the locomotive count. Further demonstration of abstract and concrete classes to follow +# At this point, my code should print out the values from the car count and the locomotive count. Further demonstration of abstract and concrete classes to follow. -class semi_Truck(GroundVehicle): +class semi_Truck(RoadVehicle): def __init__(self, _noOfTrailersAttached): self.noOfTrailersAttached = _noOfTrailersAttached + super().travel(Vehicle.status) + # Don't modify passed in values unless absolutely necessary def displayNoOfTrailersAttached(self): print(self.noOfTrailersAttached) def travel(self): - print("Currently unloading") + print(Vehicle.status) Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached.") # Remember to be careful to check that you are running the method on an instance of the class, not on the class definition. -Semi_Truck1.displayNoOfTrailersAttached() \ No newline at end of file +Semi_Truck1.displayNoOfTrailersAttached() + + +# Next - implement abstracted methods and constructor classes. Demonstrate use of super if Python supports it. \ No newline at end of file -- 2.47.3 From ffad05e5ef1ca8c48c1a2c35bbe0d2ca9d0aa1d5 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 7 Jul 2022 10:42:43 -0500 Subject: [PATCH 05/11] plop --- fleet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fleet.py b/fleet.py index 6d70996..92a0ca8 100644 --- a/fleet.py +++ b/fleet.py @@ -85,10 +85,11 @@ Train1.displayLocomotiveCount() # At this point, my code should print out the values from the car count and the locomotive count. Further demonstration of abstract and concrete classes to follow. +# Always encapsulate parent constructors into child classes to make those variables available class semi_Truck(RoadVehicle): def __init__(self, _noOfTrailersAttached): self.noOfTrailersAttached = _noOfTrailersAttached - super().travel(Vehicle.status) + super(Vehicle.status,GroundVehicleInterface.travel()) # Don't modify passed in values unless absolutely necessary def displayNoOfTrailersAttached(self): print(self.noOfTrailersAttached) -- 2.47.3 From c8823dbff4643472394a380cc88ddb4dc82937b0 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 7 Jul 2022 11:33:54 -0500 Subject: [PATCH 06/11] saving demonstrating super call 1 level up --- fleet.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fleet.py b/fleet.py index 92a0ca8..37e738e 100644 --- a/fleet.py +++ b/fleet.py @@ -87,19 +87,20 @@ Train1.displayLocomotiveCount() # Always encapsulate parent constructors into child classes to make those variables available class semi_Truck(RoadVehicle): - def __init__(self, _noOfTrailersAttached): + def __init__(self, _noOfTrailersAttached, _axlecount): self.noOfTrailersAttached = _noOfTrailersAttached - super(Vehicle.status,GroundVehicleInterface.travel()) + # super in Python returns an object representing the parent class and + super().__init__(_axlecount) # Don't modify passed in values unless absolutely necessary - def displayNoOfTrailersAttached(self): - print(self.noOfTrailersAttached) + def displaySemiAttributes(self): + print(self.noOfTrailersAttached, self.axleCount) def travel(self): print(Vehicle.status) -Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached.") +Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached", f"and {4} axles.") # Remember to be careful to check that you are running the method on an instance of the class, not on the class definition. -Semi_Truck1.displayNoOfTrailersAttached() +Semi_Truck1.displaySemiAttributes() # Next - implement abstracted methods and constructor classes. Demonstrate use of super if Python supports it. \ No newline at end of file -- 2.47.3 From 83a5e88553f43bf293c88942c8001fd71f5b2e01 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 7 Jul 2022 12:00:28 -0500 Subject: [PATCH 07/11] saving 1st chained super call --- fleet.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fleet.py b/fleet.py index 37e738e..0d658c7 100644 --- a/fleet.py +++ b/fleet.py @@ -55,16 +55,17 @@ class GroundVehicleInterface(ABC): class GroundVehicle(Vehicle, GroundVehicleInterface): @abstractmethod - def __init__(self, volume): + def __init__(self, _isModular, _moveGroundVehicle): # default value set to true. Many ground vehicles will have trailers or train cars. Modified as needed - self.isModular = True - self.moveGroundVehicle = float(input()) + self.isModular = _isModular + self.moveGroundVehicle = _moveGroundVehicle class RoadVehicle(GroundVehicle): @abstractmethod - def __init__(self, _axlecount): + def __init__(self, _axlecount, _isModular, _moveGroundVehicle): self.axleCount = _axlecount + super().__init__(_isModular, _moveGroundVehicle) class Train(GroundVehicle): def __init__(self, _noOfCarsAttached, _locomotiveCount): @@ -87,20 +88,20 @@ Train1.displayLocomotiveCount() # Always encapsulate parent constructors into child classes to make those variables available class semi_Truck(RoadVehicle): - def __init__(self, _noOfTrailersAttached, _axlecount): + def __init__(self, _noOfTrailersAttached, _axlecount, _isModular, _moveGroundVehicle): self.noOfTrailersAttached = _noOfTrailersAttached # super in Python returns an object representing the parent class and - super().__init__(_axlecount) + super().__init__(_axlecount, _isModular, _moveGroundVehicle) # Don't modify passed in values unless absolutely necessary def displaySemiAttributes(self): print(self.noOfTrailersAttached, self.axleCount) def travel(self): print(Vehicle.status) -Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached", f"and {4} axles.") - +Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached", f"and {4} axles.", True, [49.8900000, 50.900000]) +# When possible, build your argument requirements from the top down so that by the time you implement your concrete classes, you know all the data points that you need to include. # Remember to be careful to check that you are running the method on an instance of the class, not on the class definition. -Semi_Truck1.displaySemiAttributes() +# Semi_Truck1.displaySemiAttributes() # Next - implement abstracted methods and constructor classes. Demonstrate use of super if Python supports it. \ No newline at end of file -- 2.47.3 From ed5eedec216338187afb7d6df25c5e0738daf546 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 7 Jul 2022 15:54:35 -0500 Subject: [PATCH 08/11] added in additional inherited parameters (I think all of them?)' --- fleet.py | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/fleet.py b/fleet.py index 0d658c7..88b2957 100644 --- a/fleet.py +++ b/fleet.py @@ -1,7 +1,6 @@ from abc import ABC, abstractmethod # ABC is imported from the standard library since Python does not natively support abstract methods and classes. class Fleet(): - vehicles = ["7E19H2", "N9460G32581A3", "BN4681"] def __init__(self, vtype, movspeed, travelmed, vehicleid): self.vehicletype = vtype @@ -49,23 +48,22 @@ class GroundVehicleInterface(ABC): '''Resource on Python interfaces. This is duck typed. https://realpython.com/python-interface/ Interfaces make a contract that a method must be implemented if an interface is inherited and allows differing implementations of the same method.''' @abstractmethod def travel(self): - Vehicle.velocity = self.moveGroundVehicle - print("Traveling") + pass class GroundVehicle(Vehicle, GroundVehicleInterface): @abstractmethod - def __init__(self, _isModular, _moveGroundVehicle): - # default value set to true. Many ground vehicles will have trailers or train cars. Modified as needed + def __init__(self, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): + super().__init__(_gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) self.isModular = _isModular self.moveGroundVehicle = _moveGroundVehicle class RoadVehicle(GroundVehicle): @abstractmethod - def __init__(self, _axlecount, _isModular, _moveGroundVehicle): + def __init__(self, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): + super().__init__(_isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) self.axleCount = _axlecount - super().__init__(_isModular, _moveGroundVehicle) class Train(GroundVehicle): def __init__(self, _noOfCarsAttached, _locomotiveCount): @@ -73,9 +71,9 @@ class Train(GroundVehicle): self.locomotiveCount = _locomotiveCount def displayCarCount(self): - print(self.noOfCarsAttached) + print(f"The train has {self.noOfCarsAttached} cars attached.") def displayLocomotiveCount(self): - print(self.locomotiveCount) + print(f"The train has {self.locomotiveCount} locomotives attached.") def travel(self): print("Speed 60mph, Direction E") @@ -88,20 +86,35 @@ Train1.displayLocomotiveCount() # Always encapsulate parent constructors into child classes to make those variables available class semi_Truck(RoadVehicle): - def __init__(self, _noOfTrailersAttached, _axlecount, _isModular, _moveGroundVehicle): + def __init__(self, _noOfTrailersAttached, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): self.noOfTrailersAttached = _noOfTrailersAttached # super in Python returns an object representing the parent class and - super().__init__(_axlecount, _isModular, _moveGroundVehicle) + super().__init__(_axlecount, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) # Don't modify passed in values unless absolutely necessary def displaySemiAttributes(self): print(self.noOfTrailersAttached, self.axleCount) def travel(self): - print(Vehicle.status) + print(self.status) -Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached", f"and {4} axles.", True, [49.8900000, 50.900000]) + # When possible, build your argument requirements from the top down so that by the time you implement your concrete classes, you know all the data points that you need to include. # Remember to be careful to check that you are running the method on an instance of the class, not on the class definition. # Semi_Truck1.displaySemiAttributes() -# Next - implement abstracted methods and constructor classes. Demonstrate use of super if Python supports it. \ No newline at end of file +# Next - implement abstracted methods and constructor classes. Demonstrate use of super if Python supports it. +# Use these values in instances and show that values can be accessed regardless of what level they live on. +# Make vehicle objects, add them to the fleet, and then have displayAllVehicles show the newly added vehicle. Stretch/further off, have different types of vehicles travel regardless of type. + +''' +Code scratchpad + +For the travel method implemented from the interface + +Vehicle.velocity = self.moveGroundVehicle + print("Traveling") + +Object implementation + +Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached", f"and {4} axles.", True, [49.8900000, 50.900000]) +''' \ No newline at end of file -- 2.47.3 From 16ffd302de4516795ebd164f59e18657f39e89b8 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 7 Jul 2022 16:00:57 -0500 Subject: [PATCH 09/11] created notes file and .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e1fa2d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.md \ No newline at end of file -- 2.47.3 From b1943346ea2a308dd11192ca50e770c5124f04b3 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Tue, 12 Jul 2022 09:37:13 -0500 Subject: [PATCH 10/11] saving work on adding attributes to instance --- fleet.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/fleet.py b/fleet.py index 88b2957..3733196 100644 --- a/fleet.py +++ b/fleet.py @@ -2,6 +2,8 @@ from abc import ABC, abstractmethod # ABC is imported from the standard library since Python does not natively support abstract methods and classes. class Fleet(): + fleet_members = [] + def __init__(self, vtype, movspeed, travelmed, vehicleid): self.vehicletype = vtype self.movementspeed = movspeed @@ -16,8 +18,8 @@ class Fleet(): def displayVehicleType(self): print(self.vehicletype) - def addVehicles(self, newVehicleId): - self.vehicles.append(newVehicleId) + def addVehicle(self, newVehicleId): + self.fleet_members.append(newVehicleId) # vehicle1 = Fleet("car", 120, "ground", Fleet.vehicles[0]) @@ -35,7 +37,7 @@ class Vehicle(ABC): # https://www.geeksforgeeks.org/inheritance-and-composition-in-python/ @abstractmethod - def __init__(self, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): + def __init__(self, _gpsPosition, vtype,movspeed, travelmed, vehicleid, _velocity, _weight, _velocityType, _weightType, _status): self.vehicleObject = Fleet() self.gpsPosition = _gpsPosition self.velocity = _velocity @@ -56,13 +58,14 @@ class GroundVehicle(Vehicle, GroundVehicleInterface): def __init__(self, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): super().__init__(_gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) self.isModular = _isModular + # modifier to GPS position self.moveGroundVehicle = _moveGroundVehicle class RoadVehicle(GroundVehicle): @abstractmethod - def __init__(self, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): - super().__init__(_isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) + def __init__(self, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid): + super().__init__(_isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid) self.axleCount = _axlecount class Train(GroundVehicle): @@ -86,20 +89,22 @@ Train1.displayLocomotiveCount() # Always encapsulate parent constructors into child classes to make those variables available class semi_Truck(RoadVehicle): - def __init__(self, _noOfTrailersAttached, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): + def __init__(self, _noOfTrailersAttached, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid): self.noOfTrailersAttached = _noOfTrailersAttached # super in Python returns an object representing the parent class and - super().__init__(_axlecount, _axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) + super().__init__(_axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid) # Don't modify passed in values unless absolutely necessary def displaySemiAttributes(self): print(self.noOfTrailersAttached, self.axleCount) def travel(self): print(self.status) + +STruck = semi_Truck(2, 4, True, [40.0000, 40.0000], [56.0000, 89.0000], 60, 90000, "mph", "lbs,", "Ready", "Semi Truck", 100, "Ground", "1F8HNG7") # When possible, build your argument requirements from the top down so that by the time you implement your concrete classes, you know all the data points that you need to include. # Remember to be careful to check that you are running the method on an instance of the class, not on the class definition. -# Semi_Truck1.displaySemiAttributes() +STruck.displaySemiAttributes() # Next - implement abstracted methods and constructor classes. Demonstrate use of super if Python supports it. -- 2.47.3 From 2b7f6e582bf5a25e6e5e88d5aff00011ab47e271 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Tue, 12 Jul 2022 10:21:07 -0500 Subject: [PATCH 11/11] saving functional display of super(), ready for review --- fleet.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/fleet.py b/fleet.py index 3733196..16e1015 100644 --- a/fleet.py +++ b/fleet.py @@ -21,13 +21,7 @@ class Fleet(): def addVehicle(self, newVehicleId): self.fleet_members.append(newVehicleId) -# vehicle1 = Fleet("car", 120, "ground", Fleet.vehicles[0]) - -# vehicle1.displayAllFleetMembers() -# addVehicle = Fleet("hovercraft", 50, "ground/water", 0) - -# vehicle1.displayAllFleetMembers() @@ -37,8 +31,8 @@ class Vehicle(ABC): # https://www.geeksforgeeks.org/inheritance-and-composition-in-python/ @abstractmethod - def __init__(self, _gpsPosition, vtype,movspeed, travelmed, vehicleid, _velocity, _weight, _velocityType, _weightType, _status): - self.vehicleObject = Fleet() + def __init__(self, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid): + self.vehicleObject = Fleet(vtype,movspeed, travelmed, vehicleid) self.gpsPosition = _gpsPosition self.velocity = _velocity self.velocityType = _weight @@ -55,8 +49,8 @@ class GroundVehicleInterface(ABC): class GroundVehicle(Vehicle, GroundVehicleInterface): @abstractmethod - def __init__(self, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status): - super().__init__(_gpsPosition, _velocity, _weight, _velocityType, _weightType, _status) + def __init__(self, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid): + super().__init__(_gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid) self.isModular = _isModular # modifier to GPS position self.moveGroundVehicle = _moveGroundVehicle @@ -95,7 +89,7 @@ class semi_Truck(RoadVehicle): super().__init__(_axlecount, _isModular, _moveGroundVehicle, _gpsPosition, _velocity, _weight, _velocityType, _weightType, _status, vtype,movspeed, travelmed, vehicleid) # Don't modify passed in values unless absolutely necessary def displaySemiAttributes(self): - print(self.noOfTrailersAttached, self.axleCount) + print(f"The semi has {self.noOfTrailersAttached} trailers attached", f"and {self.axleCount} axles.") def travel(self): print(self.status) @@ -122,4 +116,12 @@ Vehicle.velocity = self.moveGroundVehicle Object implementation Semi_Truck1 = semi_Truck(f"This truck has {2} trailers attached", f"and {4} axles.", True, [49.8900000, 50.900000]) + +# vehicle1 = Fleet("car", 120, "ground", Fleet.vehicles[0]) + +# vehicle1.displayAllFleetMembers() + +# addVehicle = Fleet("hovercraft", 50, "ground/water", 0) + +# vehicle1.displayAllFleetMembers() ''' \ No newline at end of file -- 2.47.3