kmahadev

Shape Tester

Aug 25th, 2012
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1.  
  2. public class ShapeTester {
  3.  
  4. /**
  5. * @param args
  6. */
  7. public static void main(String[] args) {
  8. // TODO Auto-generated method stub
  9.  
  10. Shape[] shapes = new Shape[8];
  11. Point [] points = new Point[4];
  12.  
  13. Point p1 = new Point(0,4);
  14. Point p2 = new Point(3,4);
  15. Point p3 = new Point(3,0);
  16. Point p4 = new Point();
  17.  
  18. points[0] = p1;
  19. points[1] = p2;
  20. points[2] = p3;
  21. points[3] = p4;
  22.  
  23. /*
  24. for(Point p : points) {
  25. System.out.println(p);
  26. }
  27. */
  28.  
  29. //Rectangle r1 = new Rectangle(p1, p2, p3, p4);
  30. Shape r1 = new Rectangle(p1, p2, p3, p4);
  31.  
  32. System.out.println("Distance between p1 & p2: " + r1.distanceFormula(p2, p3));
  33. System.out.println(r1);
  34.  
  35.  
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment