Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2. BodyTester.java     MrG 2012.0621
  3. purpose:    model a single body in space!
  4. required files: BodyTester.java     main class
  5.         Body.java       derived class
  6.         Vector.java     adt class
  7.         StdDraw.java        graphics class
  8. translator: javac BodyTester.java
  9. interpreter:    java BodyTester rx ry vx vy
  10. */
  11. public class BodyTester
  12. {
  13.     public static void main(String[] args)
  14.     {
  15.         double rx = Double.parseDouble(args[0]);
  16.         double ry = Double.parseDouble(args[1]);
  17.         double vx = Double.parseDouble(args[2]);
  18.         double vy = Double.parseDouble(args[3]);
  19.         Vector pos = new Vector(rx,ry);
  20.         Vector vel = new Vector(vx,vy);
  21.         Body mars = new Body(pos, vel);
  22.         while(true)
  23.         {
  24.             mars.draw();
  25.             mars.move(.01);
  26.             StdDraw.show(50);
  27.         }
  28.     }
  29. }