Question: (C ++ , do not use stdio.h Write a class named Car that has the following member variables: Year: An int that holds the car's

(C ++ , do not use stdio.h

(C ++ , do not use stdio.h Write a class named Car

Write a class named Car that has the following member variables: Year: An int that holds the car's model year Make: a string that holds the make of the car Speed. An int that holds the car's current speed . The class should also has 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 con-structure should initialize the speed member variable to 0. accessor: Appropriate 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 10 to the speed member variable each time it is called. brake. The break function should subtract 10 from the speed member variable each time it is called. onstrate the class in a program that creates a Car object, and then calls the accelerate function three times. After each call to the accelerate function, get the current speed of the car and display it. Then call the brake function three times. After each call to the break function, get the current speed of the car and display it

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!