Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public static final int WINDOW_MAXWIDTH = 800; public static final int WINDOW_MAXHEIGHT = 650; public static void moveToCenterMakeSmallGrowChangeColor(Circles ball) puts the ball in the center

public static final int WINDOW_MAXWIDTH = 800; public static final int WINDOW_MAXHEIGHT = 650;

public static void moveToCenterMakeSmallGrowChangeColor(Circles ball) puts the ball in the center with a diameter of 50 and increases the size of the ball until it fills the entire canvas. It should change colors between green and yellow every 25 pixels. The ball should stay in the center of the canvas.

This is what I have so far ... not sure what I'm doing wrong. Any help will benefit! Thanks in advance

public static void moveToCenterMakeSmallGrowChangeColor(Circles ball) { int x = ball.getXPosition(); int y = ball.getYPosition(); do { x = ball.getXPosition(); y = ball.getYPosition(); int growBall = 25; ball.moveTo(x = 400 - ball.getDiameter(), y = 325 - ball.getDiameter()); ball.changeDiameter(50); for (int i = 0; i <= growBall; ++i) { ball.setColor("green"); ball.changeDiameter(growBall++); ball.setColor("yellow"); ball.changeDiameter(growBall++); ball.setColor("green"); ball.changeDiameter(growBall++); ball.setColor("yellow"); growBall++; } }while(x <= WINDOW_MAXWIDTH - ball.getDiameter() && y <= WINDOW_MAXHEIGHT - ball.getDiameter());

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

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago