Question: Please answer question in C++, In this lab you will expand your SpacePoint class to include the listed member functions. In an optional component you

Please answer question in C++,

In this lab you will expand your SpacePoint class to include the listed member functions.

In an optional component you will create class TriangleClass needed to represent a triangle w/ points in space.

Then in main() run a sequence of tests without reading input or writing output. Then, only if all tests pass, write "ALL TESTS PASSED!" with endline.

PointClass:

class SpacePoint { public: void SetCoords(int x, int y); // Sets the value for member variables xCoord and yCoord int GetX(); // returns xCoord int GetY(); // returns yCoord SpacePoint operator+(SpacePoint b); // Overloads '+' operator and adds two points: // (x1,y1)+(x2,y2) is (x1+x2, y1+y2) private: int xCoord; int yCoord; }; 

TriangleClass:

class TriangleClass { public: void SetPoints(SpacePoint A, SpacePoint B, SpacePoint C); double GetArea(); private: SpacePoint A; SpacePoint B; SpacePoint C; };

Example,

#include #include using namespace std;

class SpacePoint { public: void SetCoords(int x, int y); // Sets the value for member variables xCoord and yCoord int GetX(); // returns xCoord int GetY(); // returns yCoord SpacePoint operator+(SpacePoint b); // Overloads '+' operator and adds two points: // (x1,y1)+(x2,y2) is (x1+x2, y1+y2) private: int xCoord; int yCoord; };

class TriangleClass { public: void SetPoints(SpacePoint A, SpacePoint B, SpacePoint C); double GetArea(); void Print(); private: SpacePoint A; SpacePoint B; SpacePoint C; };

int main(){ }

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!