public class Point { private int x; private int y; public Point(int px, int py) { x = px; y = py; } public int getX() { return x; } public int getY() { return y; } public double distanceFromOrigin() { double dist = Math.sqrt(x*x + y*y); return dist; } public double distance(Point other) { int dx = other.x - x; int dy = other.y - y; double dist = Math.sqrt(dx*dx + dy*dy); return dist; } public void translate(int dx, int dy) { x = x + dx; y = y + dy; } public String toString() { return "(" + x + ", " + y + ")"; } }