Question
Clara World Practical 6 - Expressions, methods and arrays Problem 6_1 - Drawing a Room Hows would I write code for this question /* PERMITTED
Clara World Practical 6 - Expressions, methods and arrays
Problem 6_1 - Drawing a Room
Hows would I write code for this question
/* PERMITTED COMMANDS
move, turnLeft, turnRight, treeLeft, treeRight, treeFront, onLeaf, putLeaf, removeLeaf, mushroomFront
JAVA
if, while, for
*/
Clara finds a job as an assistant for an architect. Her first task in the new job is to draw a room of a given size.
You will be presented with a scenario shown in Figure 1. Your task is to first request the user to enter two integer numbers (room width and room height). Notice two new methods in Clara's vocabulary and have a look at the example for computing an average of two numbers that was discussed in Lecture 6, to see how these methods are used for entering a number from keyboard. These numbers must be validated so that the room fits inside Clara's world. If any of the numbers does not satisfy this requirement - user must re-enter the corresponding number. When the numbers are correctly entered - Clara must draw a room of the width and height as entered by the user. Figure 2 shows an example of the resulting room that is 18 cells wide and 5 cells high.
There is only one world you have to deal with for this exercise, as shown in Figure 1. In this world Clara always starts on the second street and in the same initial position as shown in Figure 1.
Clara finds a job as an assistant for an architect. Her first task in the new job is to draw a room of a given size. Figure 1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started