Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

What are your goals for this interview today?

Answered: 1 week ago

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago

Question

=+2 What is the operating profit when sales total 9000 skirts?

Answered: 1 week ago