Intermediate Business Programming with C++
You are a graduate student at Florida Atlantic University in the Business College's Information Technology Department. You have been asked by your advisor to write a C++ program for a faculty member in the Biology Department who is doing a study on population growth. You go to the Biology Department and they provide you with information about the program desired.
Specification:
The Biology faculty member who requested this program has provided you with the following specifications:
-
The program will be dependent on
-
the starting population: P
-
the birth rate B and
-
the death rate D:
-
-
The estimated population of a country after a year is the formula:
-
P + (P *B)/100 - (P*D)/100
-
-
The population growth rate is the formula: B - D
-
The program must have a modular design based upon the two functions:
-
growthRate( ) with arguments of birth rate and death rate
-
estimatedPopulaton( ) with arguments of population and growth rate.
-
-
The input is to be:
-
starting population
-
birth rate
-
death rate
-
number of years for the study
-
-
The output is to be:
-
a restatement of the input
-
a statement of the expected population after the number of years of the study
-
-
The program must be robust with the requirement that
-
both the birth rate and the death rate must be non-negative
-
the value of population must be greater than 2.
-
Note: Create a sample input and output screen to match the statements above.
Sample Data: Using the formulas above, enter in the Projected Population sample data into the table below:
Starting Population | Birth Rate | Death Rate | Years of Study | Projected Population |
---|---|---|---|---|
1000 | 5 | 3 | 5 | ??? |
100,000 | 10 | 15 | 10 | ??? |
500,000 | 100 | 60 | 20 | ??? |
Note: Using the sample data and the formulas above, enter the Projected Population for these values.
Design Phase:
Note: Try to create a structure chart and the pseudo code for this program. After you have done this, link to the following pages to see samples of these two design documents:
-
sc_population
-
pc_population
Coding Phase:
Note: Now that you have samples of the Specification Document, the Structure Chart and the Pseudo Code, try to write the C++ program using these tools. Try to follow the approach to programming discussed in the previous section.
Категории