Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Help! Please! Java programming language: Is this correct? Walker myWalkerl; void setup() { size(600, 600); background (255); myWalker1l = new Walker(); } void draw)

Need Help! Please! Java programming language: Is this correct?

image text in transcribed image text in transcribedimage text in transcribed

Walker myWalkerl; void setup() { size(600, 600); background (255); myWalker1l = new Walker(); } void draw) { myWalkerl.display(); mywalkerl.step(); } Step 1. Implement the Walker class. The Walker only needs two pieces of dataits x-location and its y-location. o In the constructor of the class, you need to initialize the location of the Walker to the center of the window. o Implement the display method. This method draws a black point as the Walker. o Implement the step method. This method directs the Walker to take a step. There are four possible steps. A step to the right can be simulated by incrementing x (x++); to the left by decrementing x (x--); forward by going down a pixel (y++); and backward by going up a pixel (y--). You need to use the random method to randomly pick from the above 4 choices and direct the Walker Step 2. In the main part of the sketch, create a Walker object in the setup method and display the trail of the Walker using the draw method. Step 3. Implement the Improved Walker class. NNA 4 possible steps 8 possible steps Walker myWalkerl; void setup() { size(600, 600); background (255); myWalker1l = new Walker(); } void draw) { myWalkerl.display(); mywalkerl.step(); } Step 1. Implement the Walker class. The Walker only needs two pieces of dataits x-location and its y-location. o In the constructor of the class, you need to initialize the location of the Walker to the center of the window. o Implement the display method. This method draws a black point as the Walker. o Implement the step method. This method directs the Walker to take a step. There are four possible steps. A step to the right can be simulated by incrementing x (x++); to the left by decrementing x (x--); forward by going down a pixel (y++); and backward by going up a pixel (y--). You need to use the random method to randomly pick from the above 4 choices and direct the Walker Step 2. In the main part of the sketch, create a Walker object in the setup method and display the trail of the Walker using the draw method. Step 3. Implement the Improved Walker class. NNA 4 possible steps 8 possible steps

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions