import Point; import SimpleOutput; /** * Some simple tests of the Point class. Distributed to help * students develop and test their classes. * * @author Samuel A. Rebelsky * @version 1.0 of February 2000 */ public class PointTester { /** * A helper function that can print out some information * about a point. Note that this is static because it * does not need to use any fields or non-static methods * from this class. */ public static void report(SimpleOutput pen, Point pt) { pen.println(pt.toString()); pen.println(" x: " + pt.getX()); pen.println(" y: " + pt.getY()); pen.println(" distance: " + pt.distanceFromOrigin()); pen.println(" quadrant: " + pt.getQuadrant()); pen.println(); } // report(SimpleOutput, Point) public static void main(String[] args) { // Prepare for output. SimpleOutput output = new SimpleOutput(); // Do the tests. The tests should be self documenting. output.println("Testing zero-parameter constructor"); report(output, new Point()); output.println("Testing point (1,3)"); Point pt = new Point(1,3); report(output, pt); output.println("Setting value to (-3,4)"); pt.set(-3,4); report(output, pt); output.println("Setting value to (0,-10)"); pt.set(0,10); report(output, pt); } // main(String[]) } // class PointTester