/*
 * Point.java
 *
 * A blueprint class representing a point on the Cartesian plane.
 *
 * Author: S-111 Course Staff
 */

public class Point {

    private int x;
    private int y;

    /*
     * constructor that takes values for both coordinates
     */
    public Point(int initialX, int initialY) {
        this.x = initialX;
        this.y = initialY;
    }

    /*
     * getX - accessor method for this Point object's x coordinate
     */
    public int getX() {
        return this.x;
    }

    /*
     * getY - accessor method for this Point object's y coordinate
     */
    public int getY() {
        return this.y;
    }

    /*
     * 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 
     */
    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);
    }
}
