// Helene Martin, CSE 142 // Blueprint for creating objects of type Point public class Point { // fields (state) int x; // each Point object has its own x and y int y; // constructor // called when building a new Point public Point(int initialX, int initialY) { setLocation(initialX, initialY); } // instance methods (behavior) // accessor (reads state) // returns the distance between this point and the origin public double distanceFromOrigin() { return Math.sqrt(x * x + y * y); } // mutators (change state) // changes x and y coordinates of this point to new values public void setLocation(int newX, int newY) { x = newX; y = newY; } // moves the x and y coordinates of this point public void translate(int dx, int dy) { x = x + dx; y = y + dy; } }