Exercise EC-fish
|
Fish
|
Due: Friday, December 15
5pm
|
Assignment: (This assignment is EXTRA CREDIT.)
Get the EC-fish.zip file.
In this project, you will find a LOT of files. You
should only need to look inside the School.java file. The School class
manages a collection of fish. The bottom of this file has a set
of methods for you to complete. You should NOT be modifying any
of the other files.
Each fish has the following
methods available:
// ********
accessors here
public
int getX()
public
int getY()
public
String getColor()
public
boolean getFacingLeft()
//*******
others
//draw
the fish on screen.
public
void draw()
//
This causes the fish to reverse its direction.
public
void reverseDirection()
//
remove fish from view.
public
void erase()
//
move the fish on screen by one pixel
public
void move()
//
determine if the fish is still on screen or not
public
boolean visible()
TESTING:
- There are 9 test cases for the program. Run each one and see that
the behavior matches the description on screen.
- There is also a test case 10, which is not really a tester, but
merely something of potential interest.
NOTES:
- Yellow and orange look similar to each other on some screens.
- There are likely to be some flaky behaviors in the program. There
are
some things you should not worry
about:
- a fish may be missing its body and only the eye appears
sometimes
- the "blinking" of the fish as they move
- if the window is minized or another window appears, there
could
be a problem.
- when fish are over top of each other, some of one fish may be
obscured by a blue box
- It is okay for a fish to be drawn partially off
screen.
However, if a fish is attempted to be moved WAY off screen, it will
crash the program.
- The Application.java file is where main() is, so compile with javac *.java and run with java Application
- The
code in some of these classes is NOT model code. Some of it has been
written in very inefficient manners, but it serves to work on both
campus Macs and PCs with high frequency, including those with slightly
older versions of java.
Handin:
-
Be sure to read the general handin instructions on the exercises page.
-
Rename the folder containing all of the files to be
"lastname-firstname-100SectionLetter-fish". For example, if I were in Section Z, I would rename my folder to
be: "McElfresh-Scott-100Z-fish"
(without the quotes).
- Create a zip file of this folder, with the same name as the folder (except
with the .zip ending this time). Instructions for zipping can be found in
the system and software handouts linked on the main course page.
- Submit this file via the electronic
handin. If you have problems, contact me.
|