Exam 1 Practice Question

Here's a problem in four parts. Do them in order. Each part is worth a certain number of points as specified below.

What to turn in

  1. Create a folder named Exam1Practice in your folder on the T: drive. Spell it exactly that way with a capital letter "E" and "P" and no spaces.
  2. Your folder should have one Java file in it named Program.java.

Bouncing Ball in Grid

  1. Part 1 (40 points) In a 600-by-600 picture draw a grid of 12 squares by 12 squares. See my solution run by clicking on the run.bat file in the folder
    T:/Harcourt/Fall09/cs140/Exam1Practice/part1/
    You must use a loop to draw the grid. Full credit for putting this in a method named drawGrid that you call from the run method. Your run method would look like
  2. Part 2 (25 points) On the grid add a target to a random square on the grid. See my solution run by clicking on the run.bat file in the folder
    T:/Harcourt/Fall09/cs140/Exam1Practice/part2/
    Note on my solution there are ten filled circles alternating between red and black. Full credit for using a loop to draw the target.
  3. Part 3 (25 points) On the grid have a blue circle bounce around randomly choosing a square at random to jump to. See my solution run by clicking on the run.bat file in the folder
    T:/Harcourt/Fall09/cs140/Exam1Practice/part3/
    On my solution the circle is
  4. Part 4 (10 points) When the blue circle hits the target the program should stop and also turn the square where the target is green indicating the the target was hit. See my solution run by clicking on the run.bat file in the folder
    T:/Harcourt/Fall09/cs140/Exam1Practice/part4/
    On my solution the circle is 30 pixels wide and lands in the center of a square so it doesn't erase the grid lines. full credit on this part for doing this.