/* CSE 142, Autumn 2007, Marty Stepp This "client" program uses the Point class. */ public class PointMain { public static void main(String[] args) { // create two Point objects // (this code now uses the constructor) Point p1 = new Point(7, 2); Point p2 = new Point(4, 3); // print each point System.out.println("p1 is (" + p1.x + ", " + p1.y + ")"); System.out.println("p2 is (" + p2.x + ", " + p2.y + ")"); // compute/print each point's distance from the origin System.out.println("p1's distance from origin = " + p1.distanceFromOrigin()); System.out.println("p2's distance from origin = " + p2.distanceFromOrigin()); // move p1 and p2 and print them again p1.translate(11, 6); p2.translate(1, 7); System.out.println("p1 is (" + p1.x + ", " + p1.y + ")"); System.out.println("p2 is (" + p2.x + ", " + p2.y + ")"); // compute/print distance from p1 to p2 System.out.println("distance from p1 to p2 = " + p1.distance(p2)); } }