Write a program to answer questions like the following: Suppose the species Klingon ox has a population
Question:
Write a program to answer questions like the following: Suppose the species Klingon ox has a population of 100 and a growth rate of 15 percent, and it lives in an area of 1500 square miles. How long would it take for the population density to exceed 1 per square mile? Use the class Species in Listing 5.19 with the addition of the getDensity method from Self-Test Question 10.
Listing 5.19
Self-Test Question 10.
Define a method called getDensity that could be added to the definition of the class SpeciesSecondTry in Listing 5.6. This method has one parameter of type double that is named area. The parameter area gives the area occupied by the species, expressed in square miles. The method getDensity returns a value of type double that is equal to the number of individuals per square mile of the species. You can assume that the area is always greater than zero. The definition is very short.
Step by Step Answer:
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch