Practice #3

Download code here

Create a new empty project, name it Car, and save it on D:\ drive

Right-click the project name, Add --> New Item..., select C++ File (.cpp) and name the file main (main.cpp is used to test the class).
Right-click the project name, Add --> New Item..., select C++ File (.cpp) and name the file Car (Car.cpp contains the class implementation).
Right-click the project name, Add --> New Item..., select Header File (.h) and name the file Car (Car.h contains the class interface).

[inside Car.h]
Create a class to represent Cars. A Car object has the following data members (model, year, color, and automatic).
Add a default constructor to initialize data members
Add a constructor with parameters to set data member to some values

Show code

[inside Car.cpp]
Write the implementation for the default constructor and constructor with parameters

Show code

[inside main.cpp]
Create a few Car objects

Show code

[inside Car.h]
Write function prototypes for some Set and Get functions which allow access to data members

Show code

[inside Car.cpp]
Write the implementation for Set and Get functions

Show code

[inside main.cpp]
Extend main.cpp to test the new functions

Show code

[inside Car.h]
Write the prototype for a function named Equal that takes a Car object, returns true of both Car objects are the same

Show code

[inside Car.cpp]
Write the implementation for the function Equal

Show code

[inside main.cpp]
Write the definition for a function (NOT a member function) named Equal that takes two Car objects, returns true of both object are the same, false otherwise

Show code