/**
 * A point consists of an x-coordinate and a y-coordinate.
 * These x- and y-coordinate are integers.
 *
 * @version 1.1    January 29, 2002
 * @author Franck van Breugel
 */
public class Point
{
    private int x; // x-coordinate of this point
    private int y; // y-coordinate of this point

    /**
     * Creates a point with the specified x- and y-coordinate.
     *
     * @param x the x-coordinate of the point.
     * @param y the y-coordinate of the point.
     */
    public Point(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    /**
     * Returns the x-coordinate of this point.
     *
     * @return the x-coordinate of this point.
     */
    public int getX()
    {
        return x;
    }

    /**
     * Returns the y-coordinate of this point.
     *
     * @return the y-coordinate of this point.
     */
    public int getY()
    {
        return y;
    }

    /**
     * Returns the distance from this point to the specified point.
     *
     * @param point the other point.
     * @return the distance from this point to the specified point.
     */
    public double distanceTo(Point point)
    {
        return Math.sqrt(Math.pow(x - point.getX(), 2) +
                         Math.pow(y - point.getY(), 2));
    }

    /**
     * Returns a string representation of this point.
     *
     * @return a string representation of this point.
     */
    public String toString()
    {
        return "(" + x + "," + y + ")";
    }
}
