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 the species elephant has a population of 10 and a growth rate of 35 percent. How many years will it take for the elephant population to exceed the Klingon ox population? Use the class Species in Listing 5.17. Your program will ask for the data on both species and will respond by telling you how many years it will take for the species that starts with the lower population to outnumber the species that starts with the higher population. The two species may be entered in any order. It is possible that the species with the smaller population will never outnumber the other species. In this case, your program should display a suitable message stating
1. Practice Program 1 is sufficiently complex that it is a good example to show three aspects of program development, design, step-wise refinement, and testing. This manual has four programs that demonstrate incremental development of this Project.
1.1 YearsToOvertakePhase1 uses comments similar to pseudocode to outline a solution (a simple but useful form of designing a solution before implementing it) and adds just the code to read in two species, determines which has the lower initial population, and display the results. Appropriate test cases would include small values for the initial populations that would make the first entry the lower, another set of values to make the second entry lower, and a set of values to make the initial populations equal. When the two initial populations are equal, the programmer may be surprised that the second one entered will be assigned to lower. This last test case should make the programmer aware that this special case needs to be considered explicitly. A question worth asking is "Does it make a difference which species is assigned to lower if they have equal populations?" Sometimes it will not matter (as in this case), but other ti
The final solution to this code is in YearsToOvertake.java.
Earlier iterations are in YearsToOvertakePhase1.java, YearsToOvertakePhase2.java, and YearsToOvertakePhase3.java,.
You might also like to view...
Which of the following sites can be used to create your own social network?
a. Twitter b. YouTube c. Facebook d. Enter the Group
A drive image is "fingerprinted" using an encryption technique called ________
Fill in the blank(s) with correct word
Hub and spoke, Half mesh, and Full mesh are all valid replication topologies for DFS replication.
Answer the following statement true (T) or false (F)
You are planning to install a Windows 7 guest operating system on a virtual hard disk using VMware Workstation 12 Pro, and you intend to use a partition that is 3 TB in size. What should you do to ensure that the partition is bootable?
A. Use a UEFI firmware type. B. Enable large drive support in the BIOS screen. C. Use a dynamic virtual disk. D. Enable "LBA mode" in the drive controller window.