/* * Point.java * * A blueprint class representing a point on the Cartesian plane. */ public class Point { // the fields inside every Point object int x; int y; /* * constructor that takes values for both coordinates */ public Point(int initX, int initY) { this.x = initX; this.y = initY; } /* * equals - returns whether two Point objects are equal */ public boolean equals(Point other) { return (this.x == other.x && this.y == other.y); } /* * toString - returns a String representation of a Point object * * COMMENTED OUT FOR NOW */ //public String toString() { // return "(" + this.x + ", " + this.y + ")"; //} /* * distanceFromOrigin - an accessor method that returns the * distance of this Point from the origin */ public double distanceFromOrigin() { return Math.sqrt(this.x*this.x + this.y*this.y); } }