// This is a client program that constructs two points, translates their // coordinates, and reports their distance from the origin. public class PointClient2 { public static void main(String[] args) { // construct a point p1 with coordinates (3, 5) // construct a point p2 with (12, 4) Point p1 = new Point(); p1.x = 3; p1.y = 5; Point p2 = new Point(); p2.x = 12; p2.y = 4; // translate p1 by (-1, -2) // translate p2 by (6, 8) p1.translate(-1, -2); p2.translate(6, 8); // print p1 distance to origin // print p2 distance to origin System.out.println("p1 distance = " + p1.distanceFromOrigin()); System.out.println("p2 distance = " + p2.distanceFromOrigin()); } }