Write a CPP program to do the following using recursion:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education