Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Vehicles class that holds instances of cars; this class is completely separate from the Car class. In other words, the Car class does

image text in transcribed

Create a Vehicles class that holds instances of cars; this class is completely separate from the Car class. In other words, the Car class does not inherit from the Vehicle class. Then assign three car instances to an instance of the Vehicle class. Start with the following code below Save the file as vehicles_class,py Your output should look like this: I have 3 cars The Mercedes is a black SUV. The BMW is a silver Sedan The Ferarri is a red Super Car And they all have 4 wheels, of course Starter Code: 2 class Vehicles: def init (selt, cars): self.cars cars 9 # Parent class 18 class Car: 12 13 14 15 16 # Class attribute Wheels 4 Initializer Instance attributes def init (self, aake, cotour): self.rake make self.colour colour 18 19 # Instance nethod def description(self): return f"Theis a. # Create a suv class inherits fron car class): 25 class SUV(Carl: 26 def init o super).init( inherited attributes go here " 29 # Create Sedan class {inherits from Car class): 31 # Create a SuperCar class { inherits from Car class): 34 # create instances of cars 35 AMG GLS63 SuVC) 36 M5-Sedan 37 F68SuperCar) 39 y cars 41 Instantiate the Vehicle class 42 y cars Vehictes) 44 # Output 45 print (fI have cars:" 46 for car in ey cars.cars: print() 19 print And they all have heels, of 1/3

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

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions

Question

What is Accounting?

Answered: 1 week ago

Question

Define organisation chart

Answered: 1 week ago

Question

What are the advantages of planning ?

Answered: 1 week ago

Question

Explain the factors that determine the degree of decentralisation

Answered: 1 week ago