Question: #Need Correct full solution only Design a C++ Object-Oriented Class structure to model a simple Polygon and its relation with Points. In geometry, a Polygon

#Need Correct full solution only
#Need Correct full solution only Design a C++ Object-Oriented Class structure to
model a simple Polygon and its relation with Points. In geometry, a
Polygon is an object with a number of vertices (Points) that can
be drawn by connecting Consecutive vertices with line segments, and connecting the
last Point to the first Point. Figure 1, shows an example Polygon

Design a C++ Object-Oriented Class structure to model a simple Polygon and its relation with Points. In geometry, a Polygon is an object with a number of vertices (Points) that can be drawn by connecting Consecutive vertices with line segments, and connecting the last Point to the first Point. Figure 1, shows an example Polygon with 5 Points ((2, 1), (3,3), (5.4), (7.2).(4.-2)). Note that, consecutive Points are con nected to each other with red line segments (sides of polygon) and the last Point, i.e., (4-2) is connected to the first Point, i.e., (2, 1). Important note: If the order of Points changes, the sides of Polygon may intersect each other. For example, if the order of Points changes to: (2.1).(7.2).(5.4).(3.3).(4.-2)), you will get the Polygon in Figure 2. You Ke NOT required to model such a Polygon. You have to assume that the use of the class takes care of entering Points in the correct order such that Polygon sides do not intersect with each other. So, your task is simple. Just Figure 1: A Polygot with 5 Points don't worry about the order of points and always that the ser entered the correctly. In this question, you are asked to design a Point class with the following properties and behaviour . must have two double member variables and yas coordinates of the Point. Users of the Point class must not have access to these metubats. [1 mark must define a constructor with no arguments. This constructor can Initialize member variables toro, inside its body. Note that, this is dif- ferent from having a constructor with default arguments. This constructor serves instantintions like this: Point pt: 2 marks must define a constructor with arguments that can set member variables and y. 12 marks must have appropriate methods that allow getting the values of private members (2 marka! Figure 2: A wrong order of Points for the same Polygon in Figure 1. You don't care about this case! mest have a member method "distance To (otherP)" that computes the object's Euclidean distance to other". Note that, this method receives an instance of the Point class as parameter. Please refer to Section 4 (Appendix A) of this document for a note on the Euclidean distance 3 mark must overload >> purator so that a user can use such an statement to input the values of randy for the point: Point pi: cin >> pl: 12 marlos mest overload > Operator so that a user can use such an statement to input consecutive Points: Polygon poly2(4): cin >> poly2; [2 marks] must overload > and > and > This code fragment prints the value of 4 and V64 and may help you to implement the Euclidean distance: sinclude

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!