Question: Spring 2 0 2 4 > Practical 5 - Variables > Problem 4 - Checkerboard with boolean Make me A JAVA code using permitted commands
Spring Practical Variables Problem Checkerboard with boolean
Make me A JAVA code using permitted commands only: move; turnLeft; turnRight; treeLeft; treeRight; treeFront; onLeaf; putLeaf; removeLeaf
if else, for, while, do &&
variables
In this exercise, your job is to get Clara to create a checkerboard pattern of leaves inside an empty rectangular world Figure and produce the world similar to what is shown in Figure Figure
While producing your solution for this problem you must use at least one variable a good idea is to make this variable of type boolean This variable should be used to help Clara with it While producing your solution for this problem you must use at least one variable a good idea is to make this variable of type boolean This variable should be used to help Clara with memorising the direction of her current movement. The simplest way to approach this problem is to base your solution around the sample code for ClaraCleaner from Lecture But here, instead of cleaning the world you must produce the checkerboard pattern. Figure
You must make use of the variable that you declare in order to decide on whether to
reposition Clara to the east or to the west. Instead of working with two streets at a time and
reposition to east and west inbetween, Clara must deal with one street at a time and then call
the reposition method. The reposition method must make use of the variable you have
created and to reposition west is Clara is facing east and reposition east if Clara is facing west.
Which way she is facing should be determined using your variable.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
