Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that the population of Mexico is 1 2 8 million and the population of the United States is 3 2 3 million. Write a

Assume that the population of Mexico is 128 million and the population of the United States is 323 million. Write a program called Population that accepts two values from a user: an assumption of an annual increase in the population of Mexico and an assumption for an annual decrease in the U.S. population. Accept both figures as percentages; in other words, a 1.5 percent decrease is entered as 0.015. Write an application that displays the populations of the two countries every year until the population of Mexico exceeds that of the United States, and display the number of years it took.
An example of the program is shown below:
Enter the percent annual increase for Mexico population
Enter as a decimal.
For example, 0.5% is entered as 0.005
Enter the value >>0.008
Enter the percent annual decrease for U.S. population
Enter as a decimal.
For example, 0.5% is entered as 0.005
Enter the value >>0.002
Mexico population U.S. Population
1129.024 million 322.354 million
2130.056192 million 321.709292 million
...
...
...
92266.42742275657616 million 268.665759564153 million
93268.5588421386288 million 268.1284280450247 million
The population of Mexico will exceed the U.S. population in 93 years
The population of Mexico will be 268.5588421386288 million
and the population of the U.S. will be 268.1284280450247 million
info> The program's output is too large to include, so it has been condensed in the example above.
info> Make sure to include "The population of Mexico will exceed the U.S. population in X years", where X is the number of years, in the program's output.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions