For example, starting with
p0 = 5jackrabbits, after the first breeding season there will be
p1 = 5 + 1 = 6jackrabbits; after the second breeding season there will be
p2 = p0 + p1 = 5 + 6 = 11jackrabbits; after the third breeding season there will be
p3 = p1 + p2 = 6 + 11 = 17jackrabbits and so on.
To aid the research, Prof. Fibonacci would like you, the laboratory computing specialist, to model a jackrabbit ecosystem. The model should be initialized with the integer start, the number of jackrabbits to start, and max, the maximum number of jackrabbits the ecosystem can support (because they have no natural predators, the jackrabbit population grows until they eat all available food). start must be an integer value greater than 0; max must be an integer value greater than or equal to start; you may assume that max - start <= 1000.
The model should support the following operations:
seasons
- accepts no arguments and returns the integer number of
breeding seasons until the jackrabbit population equals or exceeds the maximum
max.
population
- accepts as input an integer i, i >= 0,
representing the number of breeding seasons since the start of the simulation
and returns the integer number of jackrabbits at the end of breeding season
i. If i exceeds the number of breeding seasons returned by
seasons
, population
should return 0 (there are no jackrabbits because
there is no food).
The professor would like to be able to run several versions of the model at the
same time to allow for comparative analysis.
And Now, the Design Test
seasons
and populations
must match the specifications given above. You may add any other procedures
you feel are necessary to implement the model.
You should describe each implementation in enough detail to show you understand the problem and you have some idea of how to solve it. If you are unsure about your answer, err on the side of providing too much detail rather than too little.
This page last modified on 27 June 2001.