milewalker
This is an old revision of the document!
MileWalker.java
public class MileWalker extends Robot // note the capital letters for the class name { public void moveMile() { move(); move(); move(); move(); // one line to conserve space move(); move(); move(); move(); } // note the robot name is not used }
MileWalkerRunner
task() { MileWalker lisa = new MileWalker (3, 2, East, 0); // declare a MileWalker robot lisa.moveMile(); // call the new method lisa.pickBeeper(); // call an old method lisa.turnLeft(); lisa.move(); lisa.pickBeeper(); lisa.moveMile(); lisa.turnOff(); }
milewalker.1566566906.txt.gz · Last modified: 2019/08/23 09:28 by frchris