Project #3: Aquarium

Project Due: May 1 2019 at 2359

  Executive Summary

To showcase your OOP design principles, you are writing an Aquarium GUI that simulates the life cycles of at least four species of animals: phytoplankton, two types of fish, and sharks. The fish and sharks must eat to survive and die if they aren't fed in a specified time. Fish eat plankton. Sharks eat fish.

Throughout the simulation, you're required to display information about the fish population and give the user the option to feed the fish (add plankton) or add new fish and sharks.

This project is designed to exercise your ability to write good Object-Oriented code in Java, which will include good use of encapsulation, data-hiding, inheritance, polymorphism, class hierarchies, interfaces, and exception handling. Ensure you spend enough time designing your classes to make adding new features easy! Time spent up front can save you a lot of time later!

Last, be creative! This project has a lot of room for creativity! (and extra credit for exceptional features) For full credit, your project must meet the requirements laid out in Parts 1-5.

Example: (though your GUI isn't expected to look exactly like this)

Honor

The course policy and the instructions it references, most pertinently COMPSCIDEPTINST 1531.1D, spell out what kinds of assistance are permissible for programming projects. The instructor can give explicit permission for things that would otherwise not be allowed. For this project, you have explicit permission
  1. to get help from any Spring 2019 IC211 instructors (any assistance must be documented though), and
  2. to use general purpose Java resources online (though such use must be documented). Resources that might specifically address this project, like the code for programs that simulate moving objects, are not allowed.
Put together the instructions referenced in the course policy and the explicit permissions above, and what you get is summarized as:
  • The only help you may receive on a project is from your instructor or the other IC211 instructors, and that help must be clearly cited. In turn, you cannot provide help to any IC211 students on this project.
  • Under no circumstance may you copy code and submit it as your own work. That is the definition of plagiarism.
  • You may not look at other people's project code, nor may you show your own code to others.
  • You can look at online resources for general purpose Java programming, but not for help writing anything that is specific to the functionality required of your project.
Part 1 (25 pts) - Creating life

Your first step is to create plankton/fish/sharks that swim around an aquarium. Your simulation should start with an appropriate number of plankton/fish/sharks based on their size and the relative size of your aquarium.

To help, here's code that will mirror your image where "image" is a BufferedImage object:

AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
tx.translate(-image.getWidth(), 0);
AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
image = op.filter(image, null);
Part 2 (15 pts) - Eating and Dying of Hunger

Fish eat plankton. Sharks eat fish. Add this functionality when fish “intersect” plankton, and shark “intersect” fish.

Fish and sharks die when they haven't eaten anything in a specified amount of time. (The time can be fixed initially, but is chosen by the user on the control panel as described in Part 5 below.)

Code Help: Look at the Rectangle class for methods you could use.

Part 3 (25 pts) - Basic Control Panel

Create a control panel or an additional window that allows the user to create additional sharks/fish/plankton.

Keep in mind, your project’s GUI doesn’t need to look exactly like this example. Add the components (Buttons, ComboBoxes, Sliders, TextFields) necessary to meet the requirements.

Part 4 (20 pts) Run/Pause

Add a start/pause button to your control panel. When paused, the fish should stop moving. When start is clicked, the fish could continue from their current position. When the simulation is paused, clicking on a shark or fish reveal its stats on the control panel. Age and hunger level must be displayed as well as a third property of your choice.

Code Help: Look again at the Rectangle class. You’ll want to check if the image’s rectangle “contains” the point where the mouse clicked.

Part 5 (15 pts) - Advance Controls

Add to your control panel a way for the user to edit settings of the simulation. At a minimum, the user should be able to change how long it takes for each species to die of starvation, and how fast they swim.

Keep in mind, your project’s GUI doesn’t need to look exactly like this example. Add the components (Buttons, ComboBoxes, Sliders, TextFields) necessary to meet the requirements.

Part 6 (Extra Credit - up to 15 pts depending on functionality and implementation)

Consider these ideas, but remember creativity is encouraged! Be creative!

How to submit

Include in your submission a README file that describes how your solution uses good OOP design. Specifically, you should include the following in your README:

And then submit everything. Make sure to include your picture files. The following looks for jpg and png extensions, but adapt it to your specific solution:

~/bin/submit -c=IC211 -p=project03 *.java *.jpg *.png README

How projects are graded / how to maximize your points

Things to keep in mind to receive full marks:
  1. Submit all required items (as described above) on time.
  2. Do not submit any .java files that do not compile!
  3. Use good object-oriented design! The means adhering to the principles of encapsulation, data/information hiding, making good use of inheritance and polymorphism.
  4. Document all of your code, and use javadoc syntax.
  5. Practice good Java Style. This means proper indentation, use of whitespace within lines of code, logical organization of chunks of code, proper naming of classes, methods, fields, and constants in accordance with Java conventions.