public class Point {
private double x;
private double y;
public Point(double xInit, double yInit) {
x = xInit;
y = yInit;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public void setX(double value) {
x=value;
}
public void setY(double value) {
y=value;
}
public void move(double newX, double newY) {
x = newX;
y = newY;
}
public void translate(double deltaX, double deltaY) {
x = x + deltaX;
y = y + deltaY;
}
public double distance(Point other) {
return Math.sqrt(Math.pow(x – other.x, 2.0) + Math.pow(y – other.y, 2.0));
}
public boolean equals(Point other) {
boolean result;
if (other == null || x != other.x || y != other.y) {
result = false;
} else {
result = true;
}
return result;
}
public String toStrig() {
return “Point: {” + x + “,” + y + “}”;
}
}