Home / Expert Answers / Computer Science / examples-you-are-required-to-design-a-simple-class-for-2-d-point-the-point-class-has-data-pa387

(Solved): Examples You are required to design a simple class for \( 2 D \) point. The point class has data ...



ExamplesYou are required to design a simple class for \( 2 D \) point. The point class has data fields \( x \) and \( y \). They are

Examples You are required to design a simple class for \( 2 D \) point. The point class has data fields \( x \) and \( y \). They are coordinates of the point in 2D space. This class must have constructor(maybe more than one), destructor(now it is empty), and setters and getters and display functions. Besides these basic functions, this point class also also has a member function which can get distance from this point to other point. Use this class to calculate the distances of between points. Enter 3 points for A,B and C. determine the distances of \( \mathrm{AB}, \mathrm{BC} \) and \( \mathrm{AC} \). nput Enter data in 3 lines. each line for one point, with 2 doubles separated by space. Output output result in 3 lines. each line for one distance with 3 fraction digits.


We have an Answer from Expert

View Expert Answer

Expert Answer


//Problem Solved #include #include using namespace std; /* Point class Having two double varciable as instance */ class Point { //Memeber variable of Point class double x,y; public: /* Constructor of point class Takes two double val
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe