stairsweeper
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| stairsweeper [2019/08/23 09:43] – [StairSweeper.java] frchris | stairsweeper [2023/08/22 09:50] (current) – frchris | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| <code java> | <code java> | ||
| import kareltherobot.Robot; | import kareltherobot.Robot; | ||
| + | |||
| + | /** | ||
| + | * Classwork | ||
| + | * @author (your name) | ||
| + | * @version (a version number or a date) | ||
| + | */ | ||
| public class StairSweeper extends Robot | public class StairSweeper extends Robot | ||
| Line 16: | Line 22: | ||
| public void climbStair() | public void climbStair() | ||
| { | { | ||
| - | turnLeft(); | + | // code needed here |
| - | move(); | + | |
| - | turnRight(); | + | |
| - | move(); | + | |
| } | } | ||
| private void turnRight() | private void turnRight() | ||
| { | { | ||
| - | turnLeft(); | + | //coded needed here |
| - | turnLeft(); | + | |
| - | this.turnLeft(); | + | |
| } | } | ||
| Line 37: | Line 38: | ||
| import kareltherobot.World; | import kareltherobot.World; | ||
| - | public class StairSweeperRunner implements Directions{ | + | public class StairSweeperRunner implements Directions |
| + | { | ||
| - | public static void main(String[] args) { | + | public static void main(String[] args) |
| + | | ||
| String steps = " | String steps = " | ||
| " | " | ||
| Line 56: | Line 59: | ||
| World.getWorld(steps); | World.getWorld(steps); | ||
| World.setVisible(); | World.setVisible(); | ||
| - | | + | |
| } | } | ||
| - | private static void task() { | + | private static void task() |
| + | | ||
| StairSweeper alexa = new StairSweeper(1, | StairSweeper alexa = new StairSweeper(1, | ||
| alexa.climbStair(); | alexa.climbStair(); | ||
| alexa.pickBeeper(); | alexa.pickBeeper(); | ||
| - | alexa.climbStair(); | + | alexa.turnOff(); |
| - | alexa.pickBeeper(); | + | |
| - | alexa.climbStair(); | + | |
| - | alexa.pickBeeper(); | + | |
| - | alexa.turnLeft(); | + | |
| } | } | ||
stairsweeper.1566567780.txt.gz · Last modified: 2019/08/23 09:43 by frchris