CS120 -- The Bunny Final
 
  1. Look at this for loop.  Write me some code with a while loop that does the same thing
  2. for(int i = 0; i < 17; i = i + 6) {
       g.drawRect(i,2*i,3*i,4*i);
    }
  3. Suppose you have a mousePressed, but don't "implements MouseListener".  What will your program do?
    1. Fail to compile
    2. Ignore the mouse
    3. Work correctly
    4. Scare small bunnies
  4. Write me a program that can draw a bunch of bunnies.  Your program must use at least TWO loops.  Pick only ONE task below.  You can only get credit for ONE of these.
  5. Points Task
    1 Draws a bunny (anything with a head, body, and at least one foot will do)
    2 Draws a field of bunnies, 6 down by 8 across.
    3
    Draws a plus-sign of bunnies, like this: 
                       **
                       **
                     ******
                     ******
                       **
                       **
    4 Draws a triangle of bunnies, 6x6, with the right angle in the lower-right of the screen
  6. Write me a program that involves bunnies and buttons.  The program should draw a bunny on the screen (two circles or squares, one for the head and one for the body, will do).  When I click on a circle, it changes color.
  7. Points Task
    1 Draws two circles/squares of different sizes such that the bottom of each circle/square is on a horizontal line
    1 Can print "You clicked on the head" or "You clicked on the body"
    1 That bodypart changes color when clicked upon
    1 Every time you click, the bunnies whiskers move
  8. Bunnies come in all different ages.  Here's a list of bunny ages:
    1.3, 1.5, 1.9, 2.1, 1.4, 5,1, 3.2, 1.7, 8.1, 0.4, 6.2, 2,3, 1.7, 2.1, 2.6, 1.9
    Write me a program that stores these ages in an array.  Then compute the following things about the bunnies
  9. Points Task
    1 Can store the ages in an array
    1 Can tell me the age of the oldest bunny
    1 Can tell me the average age of all the bunnies
    2 Can print the ages in order (you have to program a sort)