Advertisement
seby_stephens

Lesson 2 Activity 2

Nov 5th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package Lesson2;
  2. import kareltherobot.*;
  3.  
  4. public class Activity2Main implements Directions {
  5.  
  6.     public static void main(String[] args) {
  7.         World.setDelay(2);
  8.         World.setVisible();
  9.         //Declares Robot object
  10.         UrRobot gary = new UrRobot(1, 1, East, -1);
  11.         //For loop that runs 9 times so the robot move 9 times and sets 9 stacks of beepers
  12.         for(int i =0; i<9;i++){
  13.             //For loop that sets 1000 beepers
  14.             for(int j= 0; j<1000; j++){
  15.                 gary.putBeeper();
  16.             }
  17.             gary.move();
  18.         }
  19.         //Sets the 10th set of 1000 beepers
  20.         for(int j= 0; j<1000; j++){
  21.             gary.putBeeper();
  22.         }
  23.         //Turns robot and moves it facing north
  24.         gary.turnLeft();
  25.         gary.move();
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement