created 01/22/00; revised 12/10/10, 06/27/2016

# Chapter 36 Programming Exercises

For these exercises, use `getWidth()` and `getHeight()` rather than hard-coding width and height into your code.

## Exercise 1 Write an program that displays four circles in a square drawing area. Each circle is centered in one of the four quadrants of the drawing area and each circle is a different color.

## Exercise 2 Write an program that displays a set of three concentric filled circles of different colors centered in the the program's drawing area.

## Exercise 3  Draw a quadrilateral that connects the center points of the four edges of the program.

You might want a filled quadrilateral instead of just lines. To do that, use

```fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
```

and

```drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
```

where X coordinates of each vertex are put in `xPoints` and the corresponding Y coordinates are in `Ypoints`. The number of vertices are in `nPoints`.

For example, a triangle that fills the upper left half of a 100 by 200 panel could be drawn with

```int[] xPoints = [ 0, 0, 199];
int[] yPoints = [ 99, 0, 0 ];
gr.fillPolygon(  xPoints, yPoints, 3 );
```

## Exercise 4 Draw a large asterisk * in the center of the the program's drawing area by drawing four lines that intersect in the center. (Harder: draw the * using five short lines that radiate from the center of the program.)

## Exercise 5 Draw five nested rectangles of various colors.

## Exercise 6 Draw N nested rectangles, where each rectangle is spaced 5 pixels from its neighbors, no matter what the size of the program. N is an integer variable that depends on the size of the program. The larger the program, the more rectangles are drawn. You will need to use a loop for this.