Question: Hello , i need help in C++ language , please if you can include what it asked to do for git also , thank you
Hello , i need help in C++ language , please if you can include what it asked to do for git also , thank you
the source code for 2 files
CMakeLists.txt: cmake_minimum_required(VERSION 2.8.9)
project (hello)
add_executable(hello week2.cpp)
week2.cpp: #include int main(int argc, char **argv) { std::cout << "Hello World!" << std::endl; return 0; }
1. Use the project you started with by following the PowerPoint slides for week 2: CMakeLists.txt and week2.cpp. Create a git repository and add those two files. Then commit them using the commit message initial commit
2. Remove the std:: namespace declarations and add the line: using namespace std;
3. Above the main( ) function, declare a class called Vehicle. Vehicle should have 2 private integer variables numWheels and numDoors. The Vehicle class should be in a namespace called CST8219.
4. Implement 3 different public constructors: (look at slides 28 & 29) a) Vehicle( int w, int d ) //constructor for the number of wheels and doors You should be setting numWheels to w, and numDoors to d. b) Vehicle( int w) //this should call constructor a) with parameters doors = 4, and wheels = w. In other words, call: Vehicle(w, 4) c) Vehicle() //empty constructor. This should call constructor b) with wheels = 4. Constructor c) should call b), which itself calls constructor a).
5. Commit your files again using the commit message Finished constructors. Now go to the constructors and write the corresponding output statements: a. This goes in Vehicle(): cout << In constructor with 0 parameters << endl; b. This goes in Vehicle(int w): cout << In constructor with 1 parameters, wheels = << w << endl; c. This goes in Vehicle(int w, int d): cout << In constructor with 2 parameters << endl;
6. Write a destructor that only outputs a message: cout << In destructor << endl; Use git to commit your work with the message Finished destructor
7. In the main function, practice calling the constructors by writing the line: Vehicle myVehicle; //This calls constructor Vehicle() You should put the CST8219 namespace in front of the constructor.
8. Commit your work using the message Demo #1 using the command: git commit -am Demo #1
9. Now modify the constructor in the main() function to use the second constructor, but add the CST8219 namespace in front:
Vehicle myVehicle( 4 ); //This calls constructor Vehicle(int);
10. Commit your work using the message Demo #2 using the command: git commit -am Demo #2
11. Now modify the constructor in the main() function to use the second constructor:
Vehicle myVehicle( 4, 2 ); //This calls constructor Vehicle( int, int); 12. Commit your work using the message Demo #3 using the command: git commit -am Demo #3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
