Question
Implement the Point class (code for this up to the isHigher method was discussed in the lecture). The class has the following instance variables: x
Implement the Point class (code for this up to the isHigher method was discussed in the lecture). The class has the following instance variables: x coordinate (an int) y coordinate (an int) and the following methods: Constructor that sets the x and y coordinates Get and set methods Method equals if this point is equal to another point object (if the x and y coordinates are the same). Method isHigher if this point is higher than another point object (Note that we assume that the top left corner is the coordinate 0,0). Method findDistance that calculates the distance between this point and another point. (Formula for the distance between two points (x1,y1) and (x2,y2) is square root of ((x2-x1)2 + (y2-y1)2) Test the class. In the demo program, construct four points p1, p2, p3 and p4 using user-defined values. Determine Which point is the highest. (If more than one point is at the same height, you may report any one point). Whether the distance p1 p2 is more than the distance p3 p4, or p3 p4 is more than p1p2, or whether they are the same.
* I am using JGrasp
*Please complete without: "#include using namespace std;" since we haven't used them in my class
FULL QUESTION IS IN IMAGES BELOW
Implement the class for this up to the isHigh lecture). The class has the following instance variables er method was discussed in the x coordinate (an int y coordinate (an int) and the following methods Constructor that sets the x and y coordinates Get and set methods Method equals if this point is equal to another point object (if the x and y coordinates are the same). Method isHigher if this point is higher than another point object (Note that we assume that the top left corner is the coordinate 0,0)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started