Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Subject Write a complete C++ program that defines, implements, and tests a Car class. This lab practices the legacy code separation unique to C++. The

image text in transcribed

Subject Write a complete C++ program that defines, implements, and tests a Car class. This lab practices the legacy code separation unique to C++. The program is made of and TestCar.cpp. The structure of Car class is defined in the Car.h file, however, all constructors and methods should not have any implementation code in this file. Instead, all implementation code, i.e. method body, should be written in Car.cpp, which refers to the Car.h using an include directive. The TestCar.cpp files contains only the main function for testing the primary Car class The Car class consists of following components. three files: Car.h, Car.cpp, Properties (MUST be private) * o color: string o speed: double o make: string Constructors o No-argument constructor: the constructor with no parameter o Standard constructor: with the same number of parameters as properties. . Methods o For each private property, create one get) method and one set) method to provide reading and writing access to this property. o displayO: no return. It prints out the names and current values of all properties. need to speed up from standstill to 70 mph car would turn. If direction is 0, turn left, otherwise turn right o start0: no return, print with a compete sentence that how long this make of cars o turn(int direction): no return, print with a compete sentence which direction this In the main) function, create two Car objects, one from the no-argument constructor, another from the standard constructor. Before calling the object from the standard constructor, three values should be read from the user with proper prompts. At the end, call every method from each object. Preferably, first call the get) methods with cout statements, then call the set) methods to change property values. Then call the display) method to print the updated property values with proper prompt text. At the end call other regular methods

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

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions