subject

Write a class named car that has the following fields: • yearmodel: the yearmodel field is an int that holds the car's year model. • make: the make field is a string object that holds the make of the car. • speed: the speed field is an int that holds the car's current speed. in addition, the class should have the following methods: • constructor: the constructor should accept the car's year model and make as arguments. these values should be assigned to the object's yearmodel and make fields. the constructor should also assign 0 to the speed field. • accessor: the appropriate accessor methods should be implemented to access the values stored in the object's yearmodel, make, and speed fields. • accelerate: the accelerate method should add 5 to the speed field when it is called. • brake: the brake method should subtract 5 from the speed field each time it is called. demonstrate the class in a program that contains 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 print it on a separate line. then, call the brake method five times, each time printing the current speed of the car on a separate line.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:00
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
How often does colleges update the cost of attendance on their website? . a)every two years b) every four years c) every year d) every semester
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
In the microsoft® access® and microsoft excel® programs, the ribbon contains tabs that are divided into with like tools in them. parts groups containers bunches
Answers: 1
You know the right answer?
Write a class named car that has the following fields: • yearmodel: the yearmodel field is an int...
Questions
question
Mathematics, 25.09.2019 04:00
question
Mathematics, 25.09.2019 04:00
question
Biology, 25.09.2019 04:00
question
Mathematics, 25.09.2019 04:00
Questions on the website: 13722361