subject

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 accepts the car’s year model and make
as arguments. these values should be assigned to the object’s _ _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 it is called.
• get_speed
the get_speed method should return the current speed.
next, design a program that creates a car object and then calls the accelerate method
five times. after each call to the accelerate method, get the current speed of the car and
display it. then call the brake method five times. after each call to the brake method, get
the current speed of the car and display it.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What is used to analyze and summarize your data without graphical support
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
You know the right answer?
Write a class named car that has the following data attributes:

• _ _year_model (for th...
Questions
question
Chemistry, 13.10.2020 14:01
question
Mathematics, 13.10.2020 14:01
Questions on the website: 13722363