// FILE: Pondlife.java
// A simple simulation program to model the fish and weeds in a pond
import edu.colorado.simulations.*; // Provides Organism, Plant, Herbivore classes
import java.util.Vector;
/******************************************************************************
* The PondLife
Java application runs a simple simulation that
* models the fish and weeds in a pond.
*
*
The simulation is currently set up to use these values: *
Java Source Code for this class:
*
* http://www.cs.colorado.edu/~main/applications/PondLife.java
*
*
* @author Michael Main
* (main@colorado.edu)
*
* @version Feb 10, 2016
*
* @see edu.colorado.simulations.Organism
* @see edu.colorado.simulations.Plant
* @see edu.colorado.simulations.Herbivore
******************************************************************************/
public class PondLife
{
// Number of weeds in the pond
public static final int MANY_WEEDS = 2000;
// Initial size of each weed, in ounces
public static final double WEED_SIZE = 15;
// Growth rate of weeds, in ounces/week
public static final double WEED_RATE = 2.5;
// Initial number of fish in the pond
public static final int INIT_FISH = 300;
// Fish size, in ounces
public static final double FISH_SIZE = 50;
// A fish must eat FRACTION times its size during one week, or it will die.
public static final double FRACTION = 0.5;
// Average number of weeds nibbled by a fish over a week
public static final int AVERAGE_NIBBLES = 30;
// At the end of each week, some fish have babies. The total number of new
// fish born is the current number of fish times the BIRTH_RATE
// (rounded down to an integer).
public static final double BIRTH_RATE = 0.05;
// Number of weeks to simulate
public static final int MANY_WEEKS = 38;
/**
* Run the simulation, using the values indicated in the documentation.
* @param args
* not used in this implementation
**/
public static void main(String[ ] args)
{
VectorVector
of Organism
objects
* @param organisms
is an Organism
.
* @return
* the total mass of all the objects in Organism
(in ounces).
**/
public static