Question
Part B: Circles (18 points): The second part of this assignment asks you to turn in a file named Circles.java that draws a specific figure
Part B: Circles (18 points): The second part of this assignment asks you to turn in a file named Circles.java that draws a specific figure of grids of concentric circles. Your program should exactly reproduce the image at left. This image has several levels of structure. There is a basic "subfigure" that occurs throughout, containing concentric circles inside it. The subfigure is repeated to form grids. The overall drawing panel is size 500 x 350. Its background is cyan. The rectangular area behind the grids is green, and the background of the circles is yellow. The rectangles and circles are outlined in black. Each grid also has a pair of lines drawn across it in an "X" pattern. The seven figures on the panel should have the following properties
. Description (x, y) position, size of subfigure, circles per subfigure ,rows/cols
top-left (0, 0) 100 x 100 10 N/A
top-middle 1 (130, 25) 100 x 100 10 N/A
top-middle 2 (260, 0) 60 x 60 6 N/A
top-right (360, 50) 80 x 80 4 N/A bottom-left (10, 170) 48 x 48 4 3 x 3
bottom-middle (180, 200) 24 x 24 2 5 x 5 bottom-right (330, 170) 72 x 72 9 2 x 2
You can use the DrawingPanel's image comparison feature (File, Compare to Web File...) to check your output. Different operating systems draw shapes in slightly different ways, so it is normal to have some pixels different between your output and the expected output. You do not need to achieve 0 pixels difference to get full credit for your output. If there is no visible difference to the naked eye, your output is considered correct. (If your figure looks the same but has "thicker" black lines, you may be re-drawing the same shapes multiple times.)
Implementation Guidelines for Part B: To receive full credit on Part B, you are required to have two particular static methods described below. 1. Method to draw a subfigure Your first method should draw one single concentric circle subfigure. A subfigure is one set of yellow and black concentric circles, such as those at left. Different subfigures have different sizes, positions, and so on. Therefore, your method should accept several parameters so that it is possible to call it many times to draw the many different subfigures on the screen. You should assume that every subfigure's width and height are the same, and that the subfigure's size is a multiple of its number of circles, so that all coordinates are integers. 2. Method to draw a grid Once you have completed the method that produces one subfigure, write another method that produces a square grid of subfigures. It will need a lot of parameters to be flexible enough to draw each of these grids. The key point is that this single method can be called multiple times to produce all the grids in the overall figure. Your two methods should work together to remove redundancy. Assume each grid has an equal number of rows and columns. Place the following statement at the top of your Java files, so that your code can use graphics: import java.awt.*; // so that I can use Graphics
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