


// CS 120 Winter 2006 FINAL EXAM
//
//     BASIC  PROGRAMMING     Questions 0-3 (10 pt.s each)
//
//  INSTRUCTIONS:
//
//  (0)  Debug the code!  There are three bugs.  Kill them one
//       at a time.  Get this thing
//       to compile and execute!   (10 pt.s)
//  (1)  Change the code so that it actually paints TWO rows
//       of dots, one at top of screen and one row at bottom.  (10 pt.s)
//  (2)  Write a "paintColumn" method that does the same thing
//       that "paintRow" does, but vertically!  (In other words,
//       "paintCol(Graphics g)" draws a column of 100 dots
//       in graphics object "g".)
//       Hint:  Copy and paste "paintRow"!    (10 pt.s)
//  (3)  Write a call to "paintCol", so that together with
//       the call to "paintRow" from part (1) above, you see
//       a border of dots around the window.  (10 pts.)

import java.awt.*;
import java.applet.*;

public class Question0SOLUTION extends Applet
	{

	public void paint(Graphics g)
	    {
			paintRow(g);
			paintColumn(g);
		}

    private void paintRow(Graphics g)
        {
			for(int i=0; i < 100; i++)
			  {
				  g.fillOval(i*10+10, 10, 8,8);
				  g.fillOval(i*10+10, 660, 8,8);
			  }
         }
	private void paintColumn(Graphics g)
		{
			for(int i=0; i < 100; i++)
			  {
				  g.fillOval(10,i*10+10, 8,8);
				  g.fillOval(1000,i*10+10, 8,8);
			  }
		 }

	}

