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