Graphic Java

The student may experience a small amount of frustration when it comes to centering squares in a square applet area. Let's say that we are dealing with a 200 x 200 applet area and that we want to center a square in this area so that there is ten units between in it and the applet edge on all sides. Here is the line that would work for this:

The student might, at first, think that the last two numbers should both be 190. Upon reflection the student will realize that these numbers must both be 180 since 10 units on the right and the left make a total of 20 units and 200 minus 20 is 180. The same thing goes for the top and the bottom of the square.
EXAMPLE: This applet is an approximation of what the student will be expected to create. No code will be offered since the student will need to experiment with the use of the fillRect and drawRects methods to successfully complete this activity.

Recreate the simple design displayed on this page using calls to fillRect and drawRect. The color between the yellow layer and the blue layer is pink.