Question: 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()

 spinBody code is as follow int bodyWidth = this.body.getWidth(); while (this.body.getWidth()

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!