Advertisement
advictoriam

Untitled

Feb 28th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement