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
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.
Species name: String population: int growthRate: double + readInput () : void + writeOutput (): void + predictPopulation (int years): int + setSpecies (String newName, int newPopulation, double newGrowthRate): void + getName (): String + getPopulation (): int + getGrowthRate(): double + equals (Species otherObject): boolean
Step by Step Solution
3.33 Rating (171 Votes )
There are 3 Steps involved in it
public class SpeciesWithDensity private String name private int population private double growthRate public void readInput Scanner keyboard new ScannerSystemin SystemoutprintlnWhat is the species name ... View full answer
Get step-by-step solutions from verified subject matter experts
