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 03:30
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
question
Computers and Technology, 22.06.2019 06:50
Type the correct answer in the box. spell all words correctly. which view of report creation allows you to customize the report before the database program creates it? creating a report in allows you to customize the report before the database program creates it. pl asap
Answers: 1
question
Computers and Technology, 24.06.2019 13:50
What does code do? a creates a text box that says "solid black" b creates a black border of any width c creates a black border 1 pixel wide
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
Carlos, an algebra teacher, is creating a series of powerpoint presentations to use during class lectures. after writing, formatting, and stylizing the first presentation, he would like to begin writing the next presentation. he plans to insert all-new content, but he wants to have the same formatting and style as in the first one. what would be the most efficient way for carlos to begin creating the new presentation? going under the file tab and opening the first presentation, deleting all content from each page, and adding new content going under the file tab and clicking on new in the left pane, then choosing new from existing going under the design tab and clicking on themes, then selecting the theme that was used for the first template going under the design tab and opening the template that was created for the first presentation
Answers: 2
You know the right answer?
Write a class named car that has the following data attributes:

• _ _year_model (for th...
Questions
question
Mathematics, 07.05.2020 00:59
question
Biology, 07.05.2020 00:59
question
Mathematics, 07.05.2020 00:59
Questions on the website: 13722363