SHARE
TWEET

APCS_CH8_PolygonTester.java

calcpage Feb 14th, 2013 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. PolygonTester.java      MrG     2012.0208
  3. purpose: implement the ShoeLace Algorithm using ArrayLists!
  4. required files:         PolygonTester.java              main class
  5.                         Polygon.java                    derived class
  6.                         Point.java                      utility class
  7. translator phase:       javac PolygonTester.java
  8. interpreter phase:      java PolygonTester
  9. */
  10.  
  11. public class PolygonTester
  12. {
  13.         public static void main(String[] args)
  14.         {
  15.                 Point p1 = new Point(0,0);
  16.                 Point p2 = new Point(4,0);
  17.                 Point p3 = new Point(2,2);
  18.  
  19.                 Polygon blair = new Polygon();
  20.  
  21.                 blair.add(p1);
  22.                 blair.add(p2);
  23.                 blair.add(p3);
  24.  
  25.                 System.out.println("polygon = " + blair);
  26.                 System.out.println("area = " + blair.getArea());
  27.         }
  28. }
RAW Paste Data
Top