Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MileMover class
- import becker.robots.*;
- public class MileMover extends Robot {
- int i;
- int j;
- public MileMover(City city, int aStreet, int anAvenue, Direction aDirection) {
- super(city, aStreet, anAvenue, aDirection);
- }
- public void moveMile() {
- for (i=1;i<=10;i++) {
- this.move();
- }
- }
- public void move1000Miles() {
- for (j=1;j<=1000;j++) {
- this.moveMile();
- }
- }
- }
- //Main class
- import becker.robots.*;
- public class Main {
- public static void main(String[] args) {
- City Mississauga = new City();
- MileMover Robot = new MileMover(Mississauga,0,0,Direction.EAST);
- Robot.move1000Miles();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement