// Class definition for LSPointD import java.util.Random; public class LSPointD { int x, y; static Random rg = new Random(); public LSPointD() { x = Math.abs(rg.nextInt()) % 200; y = Math.abs(rg.nextInt()) % 200; } public LSPointD(int xVal, int yVal) { x = xVal; y = yVal; } public int getX() { return x; } public int getY() { return y; } public void setX(int newX) { x = newX; } public void setY(int newY) { y = newY; } // If the hit coordinates are within a radius 5 disk of this // point, then return this point. Otherwise return null. public LSPointD getHit(int hitX, int hitY) { int dist2 = ((x - hitX)*(x - hitX)) + ((y - hitY)*(y - hitY)); if (dist2 < 25) return this; return null; } }