This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 15100 RECITATION 1  FALL 2007
The growth in a population can be modeled using the logistic method. In this method, the population growth is limited by various resources (food, shelter) to some carrying capacity. The carrying capacity is the maximum number of a species that can be supported by the region. The increase in population I for one year is given by the equation #K " N & I = rN% ( $K'
where r = the annual growth rate (assuming no limits on population growth) N = the current population size at the beginning of the year K = the carrying capacity of the region ! For example, if you have an initial herd of N = 100 deer that have an annual growth rate of r = 0.5 (50% increase in one year) in a park that can support K = 500 deer, then the deer will increase in population as follows: N (at start of year) 100 140.0 190.4 249.34784000000002 311.84741468733444 370.5223119838273 418.4966842979003 452.605551678514 474.056542107559 486.35520804636263 I (increase in population) 40.0 50.4 58.94784000000001 62.499574687334395 58.674897296492894 47.974372314072994 34.108867380613724 21.450990429044985 12.298665938803648 6.6362156293606365 N (at end of year) 140.0 190.4 249.34784000000002 311.84741468733444 370.5223119838273 418.4966842979003 452.605551678514 474.056542107559 486.35520804636263 492.9914236757233 Notice that as the population approaches the carrying capacity, the annual increase begins to slow down so that the species does not become overpopulated for the given region. Exercise Using Eclipse, write a simple Java program in a project named Recitation1 that contains a class named PopulationAnalyzer with a single main method as follows: 1. Declare variables for the population, growth rate, carrying capacity and increase in population. Use names for these variables that are selfexplanatory (e.g. population instead of P). Choose appropriate types for each variable. 2. Initialize the variables for the values for the deer population in the example above. 3. Compute and output the population of the deer after each year for 10 years. Do this for one year first to make sure you're doing the computation correctly. Then modify the code so that ten years are output. Your output might look something like this: DEER POPULATION Annual Growth Rate: 0.5 Carrying Capacity: 500 Initial Population: 100.0 GROWTH OF POPULATION OVER 10 YEARS: 140.0 190.4 249.34784000000002 311.84741468733444 370.5223119838273 418.4966842979003 452.605551678514 474.056542107559 486.35520804636263 492.9914236757233 4. Experiment with the growth rate and see what happens to the output. What happens if the growth rate is 75%? 150%? Advanced Exercise (if you have time) Once you get the program above to work correctly, modify the program to output the number of deer rounded to the nearest integer. HINT: Add 0.5 to the resulting population first and then truncate it to an integer using typecasting when you display it. Why does this work? NOTE: Make sure you use the original population value for your next calculation, not the rounded value, otherwise you will get different answers since you'll be using different values in the formulas for subsequent years. When You're Done... Create a zip file of the project folder for this recitation and submit this zip file on Blackboard to the Recitation area. DO NOT ERASE YOUR RECITATION PROJECT FOLDER IN CASE WE NEED TO SEE IT LATER (IF THE SUBMISSION IS DONE INCORRECTLY). ...
View
Full
Document
This note was uploaded on 01/25/2010 for the course CS 15100 taught by Professor Tom during the Fall '07 term at Carnegie Mellon.
 Fall '07
 TOM

Click to edit the document details