harvester
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| harvester [2019/08/23 09:49] – created frchris | harvester [2020/08/27 11:44] (current) – [Harvester.java] frchris | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | The Harvester could also be called a Roomba-- this robot will pick up all the beepers, | ||
| + | ending facing West at Street7, Avenue 2. | ||
| + | |||
| + | {{:: | ||
| + | |||
| + | If you have a strategy, go for it, and try it out. If you want a suggestion you can try this: | ||
| + | * A method could pick up a row beepers, stoping when there are no others | ||
| + | * A method that would turn North and turn toward the new row | ||
| + | * If there are beepers to pick up, continue again, otherwise '' | ||
| + | |||
| + | |||
| + | ====== Harvester.java ====== | ||
| + | <code java> | ||
| + | import kareltherobot.Robot; | ||
| + | // @author Your Name | ||
| + | public class Harvester extends Robot | ||
| + | { | ||
| + | |||
| + | public Harvester(int street, int avenue, | ||
| + | Direction direction, int beepers) | ||
| + | { | ||
| + | super(street, | ||
| + | |||
| + | } | ||
| + | |||
| + | public void nameYourMethodHere() | ||
| + | { | ||
| + | // your code here | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| ====== HarvesterRunner.java ====== | ====== HarvesterRunner.java ====== | ||
| <code java> | <code java> | ||
| - | import kareltherobot.Directions; | + | |
| - | import kareltherobot.World; | + | import kareltherobot.*; |
| - | /** | + | |
| - | * 3.8 Figure 3-2 on page 43 | + | |
| - | * code on page 50-52 | + | |
| - | * Important for Chapter 5 Exercise Sparse Harvester | + | |
| - | * @author cct | + | |
| - | * | + | |
| - | */ | + | |
| public class HarvesterRunner implements Directions | public class HarvesterRunner implements Directions | ||
| { | { | ||
| - | + | public static void main(String[] args) | |
| - | public static void main(String[] args) { | + | |
| String field = " | String field = " | ||
| " | " | ||
| Line 55: | Line 82: | ||
| { | { | ||
| Harvester farmer = new Harvester(2, | Harvester farmer = new Harvester(2, | ||
| + | // your code here to use your new method(s) | ||
| farmer.turnOff(); | farmer.turnOff(); | ||
| Line 60: | Line 88: | ||
| } | } | ||
| + | </ | ||
harvester.1566568192.txt.gz · Last modified: 2019/08/23 09:49 by frchris