Question: C++ programming Car Class Write a class named Car with these member variables: year - an int that holds car's model make- a string that
C++ programming
Car Class Write a class named Car with these member variables: year - an int that holds car's model make- a string that holds car's make speed-an int that holds car's current speed The Car class should have these member functions: Constructor- accepts car's year and make as arguments and assigns these values to year and make member variables-also initializes speed to O Accessors- allow values to be retrieved from object's year, make, and speed member variables accelerate - add 5 to speed each time it is called brake-should subtract 5 from speed each time it is called Demonstrate the class with a main program. Your program should Create a Car object Call the accelerate function five times After each call to accelerate, get the current speed of the car and display it Call the brake function five times After each call to brake, get the current speed of the car and display it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
