C++ Program Write a CPP program to do the following using recursion: 1. Using the current estimated population of 7.7 Billion and an estimated growth rate of 1.06%, compute the estimated year when the population year could exceed over 20 Billion. 2. Display the year (2xxx) and estimated population values for each year as you do this processing. 3. Start with the current year and display the data in ascending order. I am specifying this as it is possible to report this in descending order if the display is done after the recursion. For this assignment, create a method that calls itself recursively, passing the year and current population to itself. You can increase the population by applying * 1.0106 to increase by 1.06%. This method can return void and thus should do all the displays and computations needed. Display the year processed and estimated population value.. The variable for the population should be a double data type. Do not allow the display to be in scientific notation. The following can help with that issue: #include cout << setprecision(11); // done once DO NOT USE GLOBAL VARIABLES, STATIC VARIABLES OR LOOP CONSTUCTS. DO NOT USE REDUCED NUMBERS - DO NOT USE 7.7 or 20 TO REPRESENT 7.7 BILLION AND 20 BILLION Deliverable is a working CPP program and pseudocode. NOTE: If you run into a stack overflow when running this program, please see the above class note regarding this issue. 7.7 Billion = 7700000000 20 Billion = 20000000000
C++ Program
Write a CPP program to do the following using recursion:
1. Using the current estimated population of 7.7 Billion and an estimated growth rate of 1.06%, compute the estimated year when the population year could exceed over 20 Billion.
2. Display the year (2xxx) and estimated population values for each year as you do this processing.
3. Start with the current year and display the data in ascending order. I am specifying this as it is possible to report this in descending order if the display is done after the recursion.
For this assignment, create a method that calls itself recursively, passing the year and current population to itself. You can increase the population by applying * 1.0106 to increase by 1.06%. This method can return void and thus should do all the displays and computations needed. Display the year processed and estimated population value..
The variable for the population should be a double data type. Do not allow the display to be in scientific notation. The following can help with that issue:
#include<iomanip>
cout << setprecision(11); // done once
DO NOT USE GLOBAL VARIABLES, STATIC VARIABLES OR LOOP CONSTUCTS.
DO NOT USE REDUCED NUMBERS - DO NOT USE 7.7 or 20 TO REPRESENT 7.7 BILLION AND 20 BILLION
Deliverable is a working CPP program and pseudocode.
NOTE: If you run into a stack overflow when running this program, please see the above class note regarding this issue.
7.7 Billion = 7700000000
20 Billion = 20000000000
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images