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:42] – 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 | ||
{ | { | ||
- | public StairSweeper(int street, int avenue, Direction direction, int beepers) | + | public StairSweeper(int street, int avenue, |
+ | Direction direction, int beepers) | ||
{ | { | ||
super(street, | super(street, | ||
Line 15: | 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 36: | 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 55: | 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.txt · Last modified: 2023/08/22 09:50 by frchris