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 6-20, 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 car_demo.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 11, slide 11 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 car_demo.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 20.
Please upload for credit.
PreviousNext
The result should look like this:
cludwick@cludwick-VirtualBox: /Chapter11\$ python3 car_truck_suv_demo.py USED CAR INVENTORY
=================
The following car is in inventory:
Make: BMW
Model: 2001
Mileage: 70000
Price: 150000.0
Number of doors: 4
The following pickup truck is in inventory.
Make: Toyota
Model: 2002
Mileage: 40000
Price: 12000.0
Drive type: 4WD
The following SUV is in inventory.
Make Volvo
Model: 2000
Mileage: 30000
Price: 18500.0
Passenger Capacity: 5 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 __init__(self, 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 set_make(self, make):
self.__make = make
def set_model(self, model):
self.__model = model
def set_mileage(self, mileage):
self.__mileage = mileage
def set_price(self, price):
self.__price = price
``` Script Continued...
\# The following methods are the accessors
\# for the class's data attributes.
def get_make(self):
return self._-make
def get_model(self):
return self.__model
def get_mileage(self):
return self.__mileage
def get_price(self):
return self. price Script Continued...
```
# The set_doors method is the mutator for the
# __doors attribute.
def set_doors(self, doors):
self.__doors = doors
# The get_doors method is the accessor for the
# __doors attribute.
def get_doors(self):
return self.__doors
```
Class, Based on the examples from slides 6 - 2 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!