Question: Create Java program that uses leaves to draw a diagonal cross in Clara's world. An example of the initial world is shown in Figure 1
Create Java program that uses leaves to draw a diagonal cross in Clara's world. An example of the initial world is shown in Figure 1 and the desired resulting world is shown in Figure 2.
Your solution must be generic and should work for various examples. In solving this problem you may assume the following facts about Clara's world:
- The world is always surrounded by trees from all four sides
- The world's width is always equal to the world's height
- Clara starts off facing east at the corner of 1st Street and 1st Avenue (as shown in Figure 1).
- Clara's resulting position and orientation is not important.
PERMITTED COMMANDS move(); turnLeft(); turnRight(); treeLeft(); treeRight(); treeFront(); onLeaf(); putLeaf(); removeLeaf(); JAVA if, else, for, while, &&, ||, ! */
Step by Step Solution
3.45 Rating (168 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
