Archived
presentation push
This commit is contained in:
@@ -33,9 +33,8 @@ class Vehicle(ABC):
|
||||
self.status = _status
|
||||
self.fuelType = _fuelType
|
||||
|
||||
@abstractmethod
|
||||
def loadCargo(self, _weight):
|
||||
pass
|
||||
self.status = "loading cargo"
|
||||
|
||||
class fuelTypes(enum.Enum):
|
||||
Diesel = 1
|
||||
@@ -108,13 +107,12 @@ class semi_Truck(RoadVehicle, GroundVehicleInterface):
|
||||
print(self.status)
|
||||
def loadCargo(self, _weight):
|
||||
super().loadCargo(_weight)
|
||||
self.status = "Loading cargo"
|
||||
# How do I access the set value in the init above?
|
||||
self.weight = _weight + input(f"Enter cargo weight (integer values only).")
|
||||
try:
|
||||
weight = int(weight)
|
||||
self.weight = _weight + int(input(f"Enter cargo weight (integer values only)."))
|
||||
print(f"The semi truck is {self.status}.", f"Cargo weight is {self.weight}.")
|
||||
except ValueError:
|
||||
self.weight = _weight + input(f"That entry was not an integer. Enter cargo weight in integers only.")
|
||||
self.weight = _weight + int(input(f"That entry was not an integer. Enter cargo weight in integers only."))
|
||||
'''
|
||||
Error message
|
||||
Enter cargo weight (integer values only).70000
|
||||
@@ -135,6 +133,7 @@ STruck.displaySemiAttributes()
|
||||
STruck.loadCargo(90000)
|
||||
|
||||
|
||||
|
||||
# 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.
|
||||
|
||||
Reference in New Issue
Block a user