Question: must be done in C++ following all instructions exactly. Write the definition of a class Car containing: data member year of type integer that holds

must be done in C++ following all instructions exactly.
Write the definition of a class Car containing: data member year of type integer that holds the car's model year. data member make of type string that holds the make of the car. data member speed of type integer that holds the car's current speed, A constructor that accepts the car's year and make as arguments and assigns them to the object's year and make member variables. The constructor should initialize the speed member variable to 0. A member function called getYear that accepts no parameters and returns the value of year. A member function called getMake that accepts no parameters and returns the value of make. A member function called getSpeed that accepts no parameters and returns the value of speed. member function called accelerate that accepts no parameters and adds 5 to the speed member variable each time it is called. member function called brake that accepts no parameters and subtracts 5 from the speed member variable each time it is called. Note: The lowest value of the speed member variable should be 0. So make sure calling the brake function never sets the speed to a negative value The following figure illustrates an example of a main program that uses the Car class, and figure 2 is a snapshot of the program's output. int main() { Car myNewCar(2020, "Mazda"); cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
