Question
In any circular region of a graphics window, you could draw a simple circle: Or you could fill that region (roughly) with a set of
In any circular region of a graphics window, you could draw a simple circle:
Or you could fill that region (roughly) with a set of 7 circles, each 1/3 the size of the big circle. There will be one in the centre, and 6 more around it, spaced 60 degrees (PI/3 radians) apart:
Each of those smaller circular areas could also be drawn as a set of 7 even smaller circles:
And this process could be repeated indefinitely, to any number of levels. Write a recursive method public static void fillCircle(double x, double y, double radius, int level) which will draw this pattern in the StdDraw window, in the circular area specified by x, y, and radius, to the indicated number of levels (the images above should be created by fillCircle(0.5,0.5,0.5,n) for n=0, 1, and 2.
Write a main method which will repeatedly prompt the user for a number n between 0 and 5, and create the images above for the values of n typed in. The program should quit when a value of -1 is entered.
Standard Draw FileStep 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