SHARE
TWEET

APCS2012_C3X9_BugMover.java

calcpage Oct 10th, 2012 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. BugMover.java           MrG     2012.1009
  3. purpose:                move a Bug object along the x-axis
  4. required files:         BugMover.java                   main class
  5.                         Bug.java                        derived class
  6. translator:             javac BugMover.java
  7. interpreter:            java BugMover
  8. */
  9.  
  10. //main class
  11. public class BugMover
  12. {
  13.         public static void main(String[] args)
  14.         {
  15.                 Bug oscar = new Bug(-20);
  16.                 System.out.println("loc = " + oscar.getPosition());
  17.                 oscar.move();
  18.                 System.out.println("loc = " + oscar.getPosition());
  19.                 oscar.move();
  20.                 System.out.println("loc = " + oscar.getPosition());
  21.                 oscar.turn();
  22.                 oscar.move();
  23.                 System.out.println("loc = " + oscar.getPosition());
  24.         }
  25. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top