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.

This project requires a new version of Species that includes the density method from Self-Test Question 10. The main program uses this new version of the class and does the following: asks the user to enter data for the species (name, population and growth rate), the area (in square miles), and the target density. Note that the solution in this manual is generalized so that the user can enter any density; it is not hard-coded for 1 per square mile. Also note that a check is made to see if the density is already at or above the target before it enters the loop to calculate the number of years.

See the code in SpeciesWithDensity.java and YearsToDensity.

Computer Science & Information Technology

You might also like to view...

You choose the envelope size from the Envelope Options dialog box

Indicate whether the statement is true or false

Computer Science & Information Technology

The AutoFill feature does NOT work with statistical functions

Indicate whether the statement is true or false.

Computer Science & Information Technology