Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Code so far: import java.awt.*; public class SquaredCircles { public static fina

ID: 3559860 • Letter: C

Question

Code so far:

import java.awt.*;

public class SquaredCircles {
public static final int WIDTH=400;
public static final int HEIGHT=400;

public static void main (String[] args) {
DrawingPanel panel = new DrawingPanel(WIDTH,HEIGHT);
Graphics g = panel.getGraphics ();
  
panel.setBackground(new Color(0, 255, 255 ) );
  
int x = 0;
int y = 0;
int size = 100;
int rows = 1;
int numSquares = 1;
  
drawManySquares ( g, numSquares, x, y, size, rows );
  
x = 10;
y = 120;
size = 24;
rows = 4;
numSquares = 4;

drawManySquares( g, numSquares, x, y, size, rows );
  
x = 150;
y = 20;
size = 40;
rows = 6;
numSquares = 5;

drawManySquares( g, numSquares, x, y, size, rows );
  
x = 130;
y = 275;
size = 36;
rows = 3;
numSquares = 3;
  
drawManySquares( g, numSquares, x, y, size, rows );
}
  
public static void drawManySquares( Graphics g, int numSquares, int x, int y, int size, int rows ) {
for ( int i = 0; i < numSquares; i++ ) {
for ( int j = 0; j < numSquares; j++ ) {
drawOneSquare( g, x + i * size, y + j * size, size, rows );
}
}
}
  
public static void drawOneSquare( Graphics g, int x, int y, int size, int rows ) {
g.setColor( Color.GREEN );
g.fillRect( x, y, size, size );
  
//Draw yellow SquareCircle
g.setColor ( Color.YELLOW );
  
int width = size / rows;
  
for ( int j = 0; j < rows / 2; j++ ) {
for ( int i = 0; i < ( rows + 1 ) / 2; i++ ) {
g.fillOval( x * i * width, y * j * width, width, width );
}
}

}
}

Explanation / Answer

did you ever figure out the code?