SHARE
TWEET

Untitled

advictoriam Feb 28th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.    This class creates a polygon object to test the Polygon class.
  3. */
  4. public class PolygonTester
  5. {  
  6.    public static void main(String[] args)
  7.    {
  8.       PolygonTester PolyTest = new PolygonTester();
  9.       System.out.println(PolyTest.testPolygon());
  10.       System.out.println("Expected: (0,0) (0,10) (10,15)"
  11.          + " (15,10) (10,0) (0,0) ");
  12.    }
  13.    
  14.    /**
  15.       Creates a polygon and returns a list of the vertices' coordinates
  16.       @return list of vertics' coordinates
  17.    */
  18.    private String testPolygon()
  19.    {
  20.       // TODO: Clean up this code by using
  21.       // anonymous objects where possible.
  22.       Polygon poly = new Polygon(6);
  23.       poly.addPoint(new Point (0,0));
  24.       poly.addPoint(new Point(0,10));
  25.       poly.addPoint(new Point(10,15));
  26.       poly.addPoint(new Point(15,10));
  27.       poly.addPoint(new Point (10,0));
  28.       poly.addPoint(new Point (0,0));
  29.       return poly.listVertices();
  30.    }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top