Advertisement
seby_stephens

Lesson 3 Activity 4 RoofBuilder

Nov 25th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package Lesson3Activity4;
  2. //Creates the RoofBuilder Robot
  3. public class RoofBuilder extends Constructicons {
  4.     /**
  5.      * Constructor for RoofBuilder class
  6.      * @param a
  7.      * @param s
  8.      * @param d
  9.      * @param b
  10.      * @ return - none
  11.      */
  12.     public RoofBuilder(int a, int s, Direction d, int b) {
  13.         super(a, s, d, b);
  14.     }
  15.  
  16.     /**
  17.      * Overrides build method of Constructicons and instills the set of instructions for the RoofBuilder
  18.      * @ param - none
  19.      * @ return - void
  20.      */
  21.     public void build(){
  22.         //Going up the roof
  23.         putBeeper();
  24.         for(int i = 0;i<5;i++){
  25.             turnRight();
  26.             move();
  27.             turnLeft();
  28.             move();
  29.             putBeeper();
  30.         }
  31.         //Going down the roof
  32.         turnLeft();
  33.         turnLeft();
  34.         for(int i = 0; i<5;i++){
  35.             move();
  36.             turnLeft();
  37.             move();
  38.             putBeeper();
  39.             turnRight();
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement