starting foreach
Create a class, named Point
to represent a point on the Cartesian plane.
Study our own Point documentation.
A point in the Cartesian plane has x and y coordinates, both of type double
.
Provide two constructors:
As with any other class you write, define a toString() method to provide the means of printing the contents of the object in an informative and concise way.
Include appropriate getters and setters. Make sure to check the javadoc to see which getters and setters we expect.
Define the following instance methods:
findDistance(): an instance method that takes as parameter a Point
. It computes and returns the distance between the current Point
(also known as this
) and the parameter, using the Pythagorean formula.
Point
objects, and returns true iff (if and only if) the distances between the current (this
) Point and each of the input points differ by less than some amount called TOLERANCE. Define TOLERANCE as a final variable with the value of 0.01.Point
. Compute, and report if any of the points created is equidistant to the other two.main
method should be short and high level: It should consist primarily of calling other methods from the class.main
into a file named TestingPoint.txt
. You will submit this file too.Point.java
file and a TestingPoint.txt
file that contains the results of your testing.@author
and @version
fields in the file documentation. Without them, the graders will not grade your work.