Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2. VectorTester.java   MrG 2012.0621
  3. purpose:    manipulate 2D Vectors!
  4. required files: VectorTester.java   main class
  5.         Vector.java     derived class
  6. translator: javac VectorTester.java
  7. interpreter:    java VectorTester
  8. */
  9. public class VectorTester
  10. {
  11.     public static void main(String[] args)
  12.     {
  13.         Vector a = new Vector(2,3);
  14.         Vector b = new Vector(3,4);
  15.         Vector c = a.sum(b);
  16.         Vector d = a.diff(b);
  17.  
  18.         System.out.println("a = " + a);
  19.         System.out.println("b = " + b);
  20.         System.out.println("a+b = " + c);
  21.         System.out.println("a-b = " + d);
  22.         System.out.println("a*b = " + a.dot(b));
  23.         System.out.println("a.abs() = " + a.abs());
  24.         System.out.println("b.abs() = " + b.abs());
  25.     }
  26. }