Answered You can hire a professional tutor to get the answer.

QUESTION

I observed the following example question in my exploration of member variables/functions and was somewhat confused as to how to code such a C++...

A string object that holds the make of the car.

• speed. Holds the car's current speed.

The class should have the following member functions.

• Constructor. The constructor should accept the car's year and make as arguments and assign these values to the object's year and make member variables. The constructor should initialize the speed member variable to 0.

•Accessors. Accessor functions should be created to allow values to be retrieved from an object's year, make, and speed member variables.

•Accelerate. The accelerate function should add 5 to the speed member variable each time it is called.

•brake. The brake function should subtract 5 from the speed member variable each time it is called.

Demonstrate the class in a program that creates a Car object and then calls the accelerate function five times. After each call to the

accelerate function, get the current speed of the car and display it. Then, call the brake function five times. After each call to the

brake function, get the current speed of the car and display it.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question