Classes, constructors and more

Late Tuesday, Jul. 17th at 8:00am

public static final double EPSILON = 1e-5;The static final modifier indicates that the value epsilon is constant and shared by all Point objects. To access it, use Point.EPSILON. Compare this to e.g. the Math.PI constant in the class Math. The provided toString method produces a String (x,y), eg "(0.0,0.0)".

Stepwise implement the following methods:

**Point(x,y) (Constructor):**sets the values of the provided instance variables x and y.**Point() (Constructor):**creates an origin (0.0,0.0) by calling the Point(x,y) constructor using**this**.**getX**and**getY:**return the value of their respective instance variables.**equals:**checks for equality of two Points. Because x and y are doubles, Equals compares x and p.x by checking whether the absolute difference of the two is less than the provided**epsilon**value, and does the same for y and p.y.**euclidDistance:**computes the Euclidian distance between this and another point: the square root of the sum of (x - p.x) squared and (y - p.y) squared.

The main method is provided and will do an initial test of your Point implementation. Add more tests to your main method.

**isEmpty:**checks if the cloud is empty.**size:**the number of elements in the cloud.**hasPoint:**uses the equals method of Point to check whether a given Point occurs in the Cloud.**addPoint:**if the Point is not in the cloud, adds the Point to the Cloud ***to the end*** of points, again so that we all print the same results because we keep the same order.**extremes:**returns null if the Cloud is empty, and an array of x and y coordinate doubles: leftmost, rightmost, top, bottom ***in that order*** otherwise. For example, if the cloud contains [ (0.0,0.0), (1.0,1.0), (2.0,0.0), (1.0,-1.0) ], the result array is [0.0, 2.0, 1.0, -1.0].**centerP:**creates a center Point (average x and average y of the Cloud).**minDist:**returns 0.0 if the Cloud is empty or has one element, and the minimal distance between two Points, otherwise.**crop:**has parameters that are two Points in the Cloud. One of these two points is a bottom corner, and the other a top corner, of a rectangle. The top corner is diagonally across from the bottom corner. Crop will remove all points outside this rectangle from the Cloud much like you would crop an image. The crop method must deal with two input points on a horizontal or vertical line segment, in which case all points not on the line segment are removed, and it must deal with two equal Points p1 and p2, in which case all Points but p1 (if is exists in the cloud) are removed from the Cloud.For example, if the two input Points are (0.0,0,0) and (1.0,1.0), all Points outside the square delimited by (0.0,0.0), (0.0,1.0), (1.0,1.0), and (0.0,1.0) are removed, but if the two input Points are (0.0,0,0) and (0.0,1.0), all Points outside the line segment delimited by (0.0,0.0), and (0.0,1.0) are removed.

The main method, again, does an initial test of the Cloud implementation.

Submit one file P9.jar, containing your Cloud.java and Point.java. To create a jar file in Eclipse, select Export from the File menu, then under wizards select Java / JAR as the wizard type. Choose the project (if necessary), uncheck Export generated class and check Export Java source files. See below: