/**
 * Points on the plane.
 *
 * @author Samuel A. Rebelsky
 * @author Yvonne Palm
 * @auther Alex Leach
 * @version 0.1 of September 2003
 */
public class Point
{
  // +--------+---------------------------------------------------
  // | Fields |
  // +--------+

  private int x;
  private int y;

  // +--------------+---------------------------------------------
  // | Constructors |
  // +--------------+

  public Point() {
    x = 0;
    y = 0;
  } // Point()

  public Point(int initialX, int initialY) {
    x = initialX;
    y = initialY;
  } // Point(int, int)

  // +---------+--------------------------------------------------
  // | Methods |
  // +---------+

  public String toString() {
    return "(" + x + "," + y + ")";
  } // toString()

  /**
   * Translate the point by the vector (deltaX,deltaY).
   */
  public void translate(int deltaX, int deltaY)
  {
    x = x + deltaX;
    y = y + deltaY;
  } // translate(int, int)

  /**
   * Compute the distance of the object from the origin.
   */
  public double distanceFromOrigin() {
    return Math.sqrt(x*x + y*y);
  } // distanceFromOrigin()

  /**
   * Determines if the current point is in the first quadrant.
   */
  public boolean inQuadrantOne() {
    if (x <= 0)
      return false;
    else if (y <= 0) 
      return false;
    else
      return true;
  } // inQuadrantOne()

} // class Point

