Question: Must be in Python 3 Please post comments on functions to give an idea of what they do. Thank you! **Define a class named Car

Must be in Python 3

Please post comments on functions to give an idea of what they do.

Thank you!

**Define a class named Car that has the following instance attributes:

year for the cars year of manufacture

make for the cars make

model for the model of the car

speed for the current speed that the car is traveling

The Car class should have an __init__ method for creating an instance of a Car. Initially, a Car should have a year of 1900, a make of Unknown, a model of Not Set and a speed of 0.

**The class should also provide the following methods:

accelerate() - The accelerate method should add 5 to the speed instance attribute each time it is called

brake() the brake method should subtract 5 from the speed instance attribute each time it is called

get_speed() - The get_speed method should return the current speed

get_model() this method should return the model of the car

get_year() this method should return the year of the car

**Your main program is to:

Create a Car object with make FORD, model Taurus, year 2005

Call the accelerate method five times. After each call to the accelerate method, get and print the current speed

Call the brake method five times. After each call to the brake method, get and print the current speed

Print out all information on this car object, using the get methods to access the speed, model and year

Create two more Car objects with make, model and year provided by the user

Store all 3 Car objects in a list, and then print out the list.

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 Databases Questions!