Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

spinBody code is as follow int bodyWidth = this.body.getWidth(); while (this.body.getWidth() > 0) { this.body.setWidth(this.body.getWidth() - 2); this.body.setXPos(this.body.getXPos() + 1); this.delay(20); } while ( this.body.getWidth()

image text in transcribed

spinBody code is as follow

int bodyWidth = this.body.getWidth(); while (this.body.getWidth() > 0) { this.body.setWidth(this.body.getWidth() - 2); this.body.setXPos(this.body.getXPos() + 1); this.delay(20); } while ( this.body.getWidth() ii. A StickFigure is able to spin round so that it displays the colour of its reverse side. (See the example video.) Uncomment the provided method spinBody () which narrows the body in a loop till it has width 0, centring it on each iteration, before expanding it again to its original size. Add code to this method to: change the colour of the body to yellow if it is red, or red if it is yellow once it reaches its minimum width complete the second while loop condition to restore the stick figure's body to its width at the start of the method You may assume in writing this method that the body of a StickFigure will always have a width that is an even number. ii. A StickFigure is able to spin round so that it displays the colour of its reverse side. (See the example video.) Uncomment the provided method spinBody () which narrows the body in a loop till it has width 0, centring it on each iteration, before expanding it again to its original size. Add code to this method to: change the colour of the body to yellow if it is red, or red if it is yellow once it reaches its minimum width complete the second while loop condition to restore the stick figure's body to its width at the start of the method You may assume in writing this method that the body of a StickFigure will always have a width that is an even number

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_2

Step: 3

blur-text-image_3

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions