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