The Practice FishGfx Program 70, 80, 90, 100 & 110 Point Versions
Assignment Purpose:
The purpose of this assignment is to review OOP and control structures with a
provided FishGfx class. The program also practices two-dimensional array
manipulation and will be a good prelude to the Marine Biology Case Study.
Write a program that uses a provided FishGfx class. This class facilitates drawing small graphics
fishes on a two-dimensional "fish tank" simulation. The provided FishGfx bytecode file allows
drawing fish and erasing fish in the fish tank without understanding or even knowing how the
FishGfx class methods are implemented. A partial FishGfx.java file is shown below, which provides
the interface information that is needed to use the class methods.
// FishGfx.java
// This is a partial source code file of the FishGfx class.
// Only the available method headings are shown. All implementations are hidden.
import java.awt.*;
class FishGfx
{
private void delay(double n)
// This method delays program execution where N is roughly the number of mili-seconds
// of the delay. This method is called after DrawFish and EraseFish.
// The only purpose of this method is to view the fish as they are drawn and erased.
public void drawFish(Graphics g, int row, int col, int clr, int num)
// draws a fish at the specified [row][col] grid location with color (clr) and a number(num)
// to identify the fish
import java.awt.*;
}
}
fish.drawFish(g,row,col,clr,count));
Another way to earn 10 extra points is to have multiple colors for the fish. This does not mean that
every fish is a different color from the one next to it. Here are the color rules:
1) All of the first in the top row are red (color 1).
2) Whenever a new row (or column) is started, the color is advanced to the next one.
3) After color 9 is used, the color needs to start over at 1.
A total of 20 extra points can be earned for doing both of these. This means the 70-point version can
be worth as much as a 90; the 80-point version can be worth as much as a 100; and the 90-point
version can be worth as much as a 110.
What will now be shown are a couple examples of 100 and 110 point programs