Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- This class creates a polygon object to test the Polygon class.
- */
- public class PolygonTester
- {
- public static void main(String[] args)
- {
- PolygonTester PolyTest = new PolygonTester();
- System.out.println(PolyTest.testPolygon());
- System.out.println("Expected: (0,0) (0,10) (10,15)"
- + " (15,10) (10,0) (0,0) ");
- }
- /**
- Creates a polygon and returns a list of the vertices' coordinates
- @return list of vertics' coordinates
- */
- private String testPolygon()
- {
- // TODO: Clean up this code by using
- // anonymous objects where possible.
- Polygon poly = new Polygon(6);
- poly.addPoint(new Point (0,0));
- poly.addPoint(new Point(0,10));
- poly.addPoint(new Point(10,15));
- poly.addPoint(new Point(15,10));
- poly.addPoint(new Point (10,0));
- poly.addPoint(new Point (0,0));
- return poly.listVertices();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement