Question: JAVA * PROBLEM 3: The following function draws mickey mouse, if you call it like * this from main: * * * draw (.5, .5,

JAVA

* PROBLEM 3: The following function draws mickey mouse, if you call it like

* this from main:

*

*

* draw (.5, .5, .25);

*

*

* Change the code to draw mickey moose instead. Your solution should be

* recursive.

*

* Before picture: http://fpl.cs.depaul.edu/jriely/ds1/images/MickeyMouse.png

* After picture: http://fpl.cs.depaul.edu/jriely/ds1/images/MickeyMoose.png

*

* You may not use any "fields" to solve this problem (a field is a variable

* that is declared "outside" of the function declaration --- either before

* or after).

*/

public static void draw (double centerX, double centerY, double radius) {

if (radius < .0005) return;

StdDraw.setPenColor (StdDraw.LIGHT_GRAY);

StdDraw.filledCircle (centerX, centerY, radius);

StdDraw.setPenColor (StdDraw.BLACK);

StdDraw.circle (centerX, centerY, radius);

double change = radius * 0.90;

StdDraw.setPenColor (StdDraw.LIGHT_GRAY);

StdDraw.filledCircle (centerX+change, centerY+change, radius/2);

StdDraw.setPenColor (StdDraw.BLACK);

StdDraw.circle (centerX+change, centerY+change, radius/2);

StdDraw.setPenColor (StdDraw.LIGHT_GRAY);

StdDraw.filledCircle (centerX-change, centerY+change, radius/2);

StdDraw.setPenColor (StdDraw.BLACK);

StdDraw.circle (centerX-change, centerY+change, radius/2);

}

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!