CSCI 157 - HW 6

Homework 6 - Chapters 1-10

Written Work (28 pts total)

Programs (120 pts total)
All of the following should have separate clients & use nested loops(NL) where indicated.

  1. (30 pts) (NL) Wherever the user presses, display a 5x5 checkerboard pattern of the fish of your choice. Include the fish you used with your submission. And yes, you are allowed to modify the fish if and as necessary or desired. Note, the fish you use must have a setColor method available in order for the client to be able to the checkerboard color patterning right.
  2. (10 pts for client; 20 pts for CircleGrid) Write a client class that asks the user for a number of rows and a number of columns. These numbers should be positive and less than 20. Use the numbers on press to construct at the presspoint a "CircleGrid" object with the requested number of rows and columns. Every other press, change which constructor you call. Use random colors generated in this client class.

    (NL) Write a CircleGrid class that draws a tiny overlapping circles. The circles should be little 30x30 pixel ovals that overlap each other by 5 pixels. These can be filled or framed ovals -- your choice. You should provide BOTH of the following constructors:

    1. A constructor that takes the following parameters in exactly the order stated: i) a number of rows going down and ii) a number of columns going across and iii) a location and iv) a drawing canvas

      For this constructor you can choose the color of all the circles or just go with classic default black.

    2. A constructor that takes the same parameters as the first described but ALSO takes a color as a parameter. For this one, ALL the ovals should be given color (or something close)

      HINT: Those having carefully read Chapter 6 will realize there's an EASY, EFFICIENT, and ROBUST way to write one of the constructors (think "this") and a harder, more tedious and error-prone way....

  3. (30 pts) Choose ONE of the following and implement:
    1. Make concentric fish of the same kind of fish with gradually smaller radii. Include the fish you used with your submission but only if different from whatever fish you used before.
    2. Make a line of rectangles gradually fading from solid blue to light blue to fully transparent.
    3. Make many, 101, stars in the night sky. This should happen on begin, not after 101 mouse presses/clicks!
    4. Repeat the text "Winner!" 100 times at random position on the screen. This should happen on begin, not after 100 mouse presses/clicks!
  4. (30 pts) Coding Standards