// CSE 142, Spring 2010, Marty Stepp // This client program creates and uses several Point objects. import java.awt.*; public class PointClient { public static void main(String[] args) { // create three Point objects Point p1 = new Point(11, 41); // constructor (8.4) // - code that runs when a client asks for a 'new' object Point p2 = new Point(22, 32); Point p3 = new Point(103, 283); System.out.println("p1's x value is " + p1.getX()); int haha = p1.getX(); haha = 999; // test our distance method System.out.println("distance from p1 to p2 = " + p1.distance(p2)); System.out.println("distance from p2 to p3 = " + p2.distance(p3)); // call our new translate method p1.translate(5, 8); p2.translate(-1, 1000); // call our new toString method System.out.println("p1 is: " + p1); System.out.println("and p2=" + p2); System.out.println("also " + p3 + " is the state of p3"); // call our draw method DrawingPanel panel = new DrawingPanel(500, 400); Graphics g = panel.getGraphics(); p1.draw(g); p2.draw(g); p3.draw(g); } }