// 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; // instance methods (behavior) -- mutators and accessors // mutator: generally void; generally take in parameters // moves x and y coordinates of this point by specified amount public void translate(int dx, int dy) { x += dx; // implicitly: this.x += dx; y += dy; } // accessor: generally return something and take no parameters // returns the distance of this Point from the origin public double distanceFromOrigin() { return Math.sqrt(x * x + y * y); } }