Advertisement
FrankyDM

Untitled

Nov 21st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.34 KB | None | 0 0
  1. package Lesson3;
  2. import kareltherobot.*;
  3.  
  4. /**
  5.  * Francesco Di Mise
  6.  * This is a program to create a building using many robots creating using separate classes
  7.  * it is possible to create various robots of the same type that serve the same function to carry out similar tasks
  8.  */
  9. public class Lesson3Activity4 implements Directions{
  10.  
  11.     /**
  12.      * The main function. Creates the robots (multiples of each in several cases)
  13.      * It also calls the build function, which exists in each sub class but performs different actions depending on the type of robot
  14.      * @param args
  15.      */
  16.     public static void main(String[] args) {
  17.         World.setDelay(15);
  18.         World.setSize(11,11);
  19.         World.setVisible();
  20.  
  21.         WallBuilder bob = new WallBuilder(1, 2, North, -1);
  22.         WallBuilder bobby = new WallBuilder(1, 10, North, -1);
  23.  
  24.         WindowBuilder jack = new WindowBuilder(5, 5, North, -1);
  25.         WindowBuilder jackie = new WindowBuilder(5, 8, North, -1);
  26.  
  27.         RoofBuilder harry = new RoofBuilder(5, 1, North, -1);
  28.  
  29.         DoorBuilder bill = new DoorBuilder(1, 5, North, -1);
  30.  
  31.         ChimneyBuilder gus = new ChimneyBuilder(7, 2, North, -1);
  32.  
  33.         bob.build();
  34.         bobby.build();
  35.         bill.build();
  36.         jack.build();
  37.         jackie.build();
  38.         harry.build();
  39.         gus.build();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement