Write a CPP program to do the following using recursion:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question

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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage