Question Solved1 Answer PLEASE CODE IN C++ Write a class named Car that has the following private member variables: · yearModel: An int that holds the car's year model make: A string that holds the make of the car • speed: An int that holds the car's current speed In addition, the class should have the following public member functions: · Constructor: Accepts two arguments. The first argument is the car's year model, and the second argument is the car's make. These values should be assigned to the yearModel and make member variables. This constructor should assign 0 to the speed field. • Default Constructor: Sets the yearModel member variable to 2022, sets the make member variable to an empty string (""), and sets the speed member variable to 0. · set YearModel: Accepts an int argument that is assigned to the yearModel member variable. The function returns no value. · setMake: Accepts a string argument that is assigned to the make member variable. The function returns no value. · set Speed: Accepts an int argument that is assigned to the speed member variable. The function returns no value. .getYearModel: Returns the value stored in the yearModel member variable. I getMake: Returns the value stored in the make member variable. get Speed: Returns the value stored in the speed member variable. • accelerate: Adds 5 to the speed member variable. The function returns no value. • brake: Subtracts 5 from the speed member variable. The function returns no value. Note: Write only the class declaration for the Car class. Do not write a main function and 1 I I not writo any include directivos

BURJAC The Asker · Computer Science

PLEASE CODE IN C++

Transcribed Image Text: Write a class named Car that has the following private member variables: · yearModel: An int that holds the car's year model make: A string that holds the make of the car • speed: An int that holds the car's current speed In addition, the class should have the following public member functions: · Constructor: Accepts two arguments. The first argument is the car's year model, and the second argument is the car's make. These values should be assigned to the yearModel and make member variables. This constructor should assign 0 to the speed field. • Default Constructor: Sets the yearModel member variable to 2022, sets the make member variable to an empty string (""), and sets the speed member variable to 0. · set YearModel: Accepts an int argument that is assigned to the yearModel member variable. The function returns no value. · setMake: Accepts a string argument that is assigned to the make member variable. The function returns no value. · set Speed: Accepts an int argument that is assigned to the speed member variable. The function returns no value. .getYearModel: Returns the value stored in the yearModel member variable. I getMake: Returns the value stored in the make member variable. get Speed: Returns the value stored in the speed member variable. • accelerate: Adds 5 to the speed member variable. The function returns no value. • brake: Subtracts 5 from the speed member variable. The function returns no value. Note: Write only the class declaration for the Car class. Do not write a main function and 1 I I not writo any include directivos
More
Transcribed Image Text: Write a class named Car that has the following private member variables: · yearModel: An int that holds the car's year model make: A string that holds the make of the car • speed: An int that holds the car's current speed In addition, the class should have the following public member functions: · Constructor: Accepts two arguments. The first argument is the car's year model, and the second argument is the car's make. These values should be assigned to the yearModel and make member variables. This constructor should assign 0 to the speed field. • Default Constructor: Sets the yearModel member variable to 2022, sets the make member variable to an empty string (""), and sets the speed member variable to 0. · set YearModel: Accepts an int argument that is assigned to the yearModel member variable. The function returns no value. · setMake: Accepts a string argument that is assigned to the make member variable. The function returns no value. · set Speed: Accepts an int argument that is assigned to the speed member variable. The function returns no value. .getYearModel: Returns the value stored in the yearModel member variable. I getMake: Returns the value stored in the make member variable. get Speed: Returns the value stored in the speed member variable. • accelerate: Adds 5 to the speed member variable. The function returns no value. • brake: Subtracts 5 from the speed member variable. The function returns no value. Note: Write only the class declaration for the Car class. Do not write a main function and 1 I I not writo any include directivos
See Answer
Add Answer +20 Points
Community Answer
LKQOKU
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

Class declaration is as follows //Declaration of class car class Car { private: //Declaration of private data members int yearModel; string make; int speed; public:// Decalartion of public data members Car(int year,string m) //Decalartion of constructor with two argume ... See the full answer