Question: Class, Based on the examples from slides 6 - 2 0 , create an Automobile SuperClass and then create make, model, mileage and price attributes.
Class,
Based on the examples from slides create an Automobile SuperClass and then create make, model, mileage and price attributes. Make sure you import the vehicles.py superclass script into the new script called cardemo.py then begin creating the Used Car Inventory based on the car, truck and SUV subclasses that you need to create. You are welcome to get creative with the input data.
FYI on Slide slide isn't really part of the vehicles.py homework, it acts as more of a way for your to test what you have worked on using a script called cardemo.py to do some practice.for the lab you may omit this slide if you like
I want to see screen captures of the code and the final output result of the used car inventory such as from the example in slide
Please upload for credit.
PreviousNext
The result should look like this:
cludwick@cludwickVirtualBox: Chapter$ python cartrucksuvdemo.py USED CAR INVENTORY
The following car is in inventory:
Make: BMW
Model:
Mileage:
Price:
Number of doors:
The following pickup truck is in inventory.
Make: Toyota
Model:
Mileage:
Price:
Drive type: WD
The following SUV is in inventory.
Make Volvo
Model:
Mileage:
Price:
Passenger Capacity: Let's put the prior example to work with a script called vehicles.py
# This Automobile Superclass will hold data
# about an automobile within the inventory
class Automobile:
# The init method accepts arguments for the
# make, model, mileage, and price. It initializes
# the data attributes with these values.
def initself make, model, mileage, price:
self. make make
self. model model
self. mileage mileage
self. price price Script Continued...
# The following methods are mutators for the
# class's data attributes.
def setmakeself make:
self.make make
def setmodelself model:
self.model model
def setmileageself mileage:
self.mileage mileage
def setpriceself price:
self.price price
Script Continued...
# The following methods are the accessors
# for the class's data attributes.
def getmakeself:
return self.make
def getmodelself:
return self.model
def getmileageself:
return self.mileage
def getpriceself:
return self. price Script Continued...
# The setdoors method is the mutator for the
# doors attribute.
def setdoorsself doors:
self.doors doors
# The getdoors method is the accessor for the
# doors attribute.
def getdoorsself:
return self.doors
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
