Class Point

java.lang.Object
  |
  +--Point

public class Point
extends java.lang.Object


Constructor Summary
Point()
          sets the default values of the Point object to 0, 0
Point(int X, int Y)
          sets the value of the Point object to the value of the X and Y parameters (which are ints)
 
Method Summary
 Point add(Point other)
          adds the x, y values of the passed object to the x, y values respectively of the Point object that invoked the method
 double distance(Point other)
          determines the distance between the x, y values of the passed object to the x, y values respectively of the Point object that invoked the method

Uses the distance function:
distance = sqrt((x2 - x1)^2 + (y2 - y1)^2)
 int getX()
          to be used for debugging or by other methods
 int getY()
          to be used for debugging or by other methods
 void set(java.lang.String X, java.lang.String Y)
          sets the value of the Point object to the value of the X and Y parameters (which are Strings)
 java.lang.String toString()
          return a string with an external representation (X and Y) of the values of the Point object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point

public Point()
sets the default values of the Point object to 0, 0

Point

public Point(int X,
             int Y)
sets the value of the Point object to the value of the X and Y parameters (which are ints)
Parameters:
int - X value in the object
int - Y value in the object
Method Detail

set

public void set(java.lang.String X,
                java.lang.String Y)
sets the value of the Point object to the value of the X and Y parameters (which are Strings)
Parameters:
int - X value in the object
int - Y value in the object

getX

public int getX()
to be used for debugging or by other methods
Returns:
internal representation of the X value

getY

public int getY()
to be used for debugging or by other methods
Returns:
internal representation of the Y value

add

public Point add(Point other)
adds the x, y values of the passed object to the x, y values respectively of the Point object that invoked the method
Parameters:
Point - another Point object
Returns:
Point object with the total new coordinates

distance

public double distance(Point other)
determines the distance between the x, y values of the passed object to the x, y values respectively of the Point object that invoked the method

Uses the distance function:
distance = sqrt((x2 - x1)^2 + (y2 - y1)^2)
Parameters:
Point - another Point object
Returns:
double distance between the two Point objects

toString

public java.lang.String toString()
return a string with an external representation (X and Y) of the values of the Point object. The format for this output is X = xx, Y = yy (where xx is the x value and yy is the y value).
Overrides:
toString in class java.lang.Object
Returns:
String