/********************************************************** This file: PointMaker.java Author: CS302 Section 5 Date: 9-24-03 **********************************************************/ /** * The PointMaker class makes some Point objects and * tests the methods of the Point class. */ class PointMaker { public static void main(String[] args) { // Make some points. Point a = new Point(4,5); Point b = new Point(0,2); // Test an accessor method. int xOfA = a.getX(); // gets 4 int xOfB = b.getX(); // gets 0 // Test the invert method. a.invert(); // a -> (5,4) // Test the add method. b.add(a); // b -> (5, 6) // Test the distance method. double dist = a.getDistanceFrom(b); // dist is 2 // Test the other methods. Point invertOfB = b.getInvert(); // invertOfB is (6,5) Point halfPoint = a.getHalfwayPoint(b); // halfPoint is (5,5) } }