Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ called Car_LastNameFirstName.cpp. It should include a class named Car that has the following member variables : You will submit 1

Write a program in C++ called Car_LastNameFirstName.cpp. It should include a class named Car that has the following member variables :

image text in transcribed

image text in transcribed

You will submit 1 file and 2 folders in a zipped folder: (LabV_LastNameFirstName.zip) A screen shot of the output from running the cpp file (LabV LastNameFirstName.doc) .Entire Project Folder for LabV_1 with all code in 1.cpp file .Entire Project Folder for LabV_2 with code separated into a class specification file, class implementation file, and the client program 1. Write a program in C++ called Car LastNameFirstName.cpp. It should include a class named Car that has the following member variables year make An int that holds the car's model year 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 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. 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 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. hat is the car's nodel Maada 'n in ny 2810 Mazda hot rod 'n accelerating. urrent speeds Snph urrent speed 18 nph urrent speedi 15 nph urrent speed: 25 nph I'n braking urrent speed: 28 nph urrent speedi 15 nph rrent speedi 18 nph urrent speeds np urrent speedt nph 2. Create a new project with the same program as above. Reorganize the code into a class specification file, class implementation file, and the client program. Submit the entire project hat is the Car's y 2010 hat is the car' s model Mazda I'm in my 2010 Mazda hot rod. I'm accelerating urrent speed: 5 mph urrent speed: 10 mph urrent speed: 15 mph urrent speed: 20 mph. urrent speed 25 mph Now I'm braking urrent speed 20 mph Current speed: 15 mph. Current speed 10 mph urrent speed: 5 mph rrent speed: mph

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+2. What reactive strategies might you develop?

Answered: 1 week ago