Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code the program below: - Create the abstract base class Vehicle with the following attributes - The methods with ABC next to them should be

image text in transcribedimage text in transcribed

Code the program below: - Create the abstract base class Vehicle with the following attributes - The methods with ABC next to them should be abstracted and overloaded in the child class - Create three child classes: car, truck, Motorcycle with these variables and methods: 1. In the __init__ methods of each child class, print out what kind of vehicle was created ( 0.5p pts) Ex: If a Car is created, print "A car was created." 2. The printDetails() method should print out the TypeOfVehicle, Model, Manufacturer, and ManufacturingNumber (0.5pts) Ex. Manufacturer: Toyota Model: al3s Wheels: 4 Type of Vehicle: Car Seats: 4 Manufacturing Number: 1 Ex: object.checkinfo(Seats=5) should print Seats + True or False depending on whether self.seats is 5 4. In your main function create the following: (1.5pts) 1. A list that contains five manufacturers . 2. A dict that contains the three types of vehicles as keys, each with a list of three different models. 3. A dict that contains the three types of vehicles as keys, each with a list of the number of seats that could be in each vehicle type (Car could have 2 to 5 , Truck could have 2 to 4 , Motorcycle could have 1 to 2 ) 4. Create a dict called totals that contains the three types of vehicles as keys, each set to equal 0 Ex. 1. manufacturers - ['Toyota', 'GM', 'Ford', 'Jeep', 'Audi'] 2. models = ['Car':['X11"i3",XFCE'], 'Truck':["Linux", "Unix", "FreeBSD"], 'Motorcycle':["Triforce", "Mushroom", "Morphball"]] 3. seats ={ 'Car': [2,3,4,5], 'Truck':[2,3,4], 'Motorcycle':[1,2]\} 4. total =[ 'Car':0, 'Truck':0, 'Motorcycle':0] The ManufacturingNumber should be equal to the current totals key. - Select one instance from the list and test its printDetails() and checklnfo(). - At the end of the loop print out the total amount of each vehicle created. - Output should be similar to these: A car was created! A car was created! A truck was created! A truck was created! A car was created! Manufacturer: GM Model: i3 Wheels: 4 Type of Vehicle: Car Seats: 5 Manufacturing Number: 1 Model: False Car: 3 , Truck: 2 , Motorcycle: 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

can you tell me about the Breen v Williams equity case?

Answered: 1 week ago