Question: 5. Lab Exercise -- C++ Inheritance Question 1 - Access Levels Fill in the blanks in the following table which describes the access levels in

 5. Lab Exercise -- C++ Inheritance Question 1 - Access Levels
Fill in the blanks in the following table which describes the access
levels in a derived class's members. i.e. State whether the member's access

5. Lab Exercise -- C++ Inheritance Question 1 - Access Levels Fill in the blanks in the following table which describes the access levels in a derived class's members. i.e. State whether the member's access level is public, private, or protected - or, if it is not accessible! : Question 2 - Programming Exercise Start with the repl code provided to you. Finish the program so that it compiles and runs. The instructions are contained in the C++ file. Your completed program should generate output similar to the following: Two default constructor This program asks for the coordinates of two point in 3D space and calculates their distance. 111 Please enter the xyz coordinates for the first point! Please enter the xyz coordinates for the second point: 2 3 4 TVD constructor with two arguments Distance is 2.24166 The following refreshes your memory on how to calculate the distance between two points in 3D place. Suppose we have the following two points in a 3D space: E The distance between point and point2 is: dis=x-x,)* + : - ;)+(5-3) More details: In main: 1. Create one ThreeD object using the default constructor. Use the setters to set x, y, and z. 2. Create the second ThreeD object using the constructor with three arguments o in the Two class: 1. Add a cout statement to the TwoD default constructor with a message "TwoD default constructor 2. Add a cout statement to other Two constructor with a message "TwoD constructor with two arguments // Filename: Exercise.cpp // Purpose: Exercise for inheritance lab #include #include // for sart() using namespace std; class TwoD { private: double x,y; // x and y coordinates public: // inline implementation of constructor TWOD({x = y = 0.0;} // default constructor TwoD(double i, double j):x(i),y(i)} // inline implementation of member functions void setX(double newX){x = newx;} void sety (double newY){y = newY;} double getX() const {return x;} double getY() const {return y;} // get distance of 20 points double getDistance (const TwoD& the SecondPoint) const; }; // calculate the distance of two 2D points double TwoD::getDistance(const TwoD& the SecondPoint) const double point1[2]; double point2[2]; double dx, dy: double distance; point1[0] = x; point1[1] = y; point2[0] = the SecondPoint.getX(); point2[1] = the SecondPoint.getY(); dx = point2[0] - point1[0]; dy = point2[1] - point1[1]; distance = sqrt(dx * dx + dy * dy); return distance; } class ThreeD:public TWOD class ThreeD:public TwoD private: double z; public: // --->ADD CODE HEREADD CODE HEREADD CODE HEREADD CODE HERE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!