Question: must be in python, really need correct code 2. Car Class Write a class named Car that has the following data attributes: year_model (for the

must be in python, really need correct code 2. Car Class Writea class named Car that has the following data attributes: year_model (formust be in python, really need correct code

2. Car Class Write a class named Car that has the following data attributes: year_model (for the car's year model) make (for the make of the car) speed (for the car's current speed) The Car class should have an__init__method that accept the car's year_model and make as arguments. These values should be assigned to the objects-year,-model and-make data attributes. It should also assign 0 to the_speed data attribute The class should also have the following methods: accelerate The accelerate method should add 5 to the speed data attribute each time it is called. brake The brake method should subtract 5 from the speed data attribute each time i is called. get speed The get speed method should return the current speed

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!