Answer to Question #294332 in C++ for subaashini

Question #294332

Design a pseucode and flowchart for the question The population of a town A is less than the population of town B. However, the population of town A is growing faster than the population of town B. Write a program that prompts the user to enter the population and growth rate of each town. The program outputs after how many years the population of town A will be greater than or equal to the population of town B and the populations of both the towns at that time. (A sample input is: Population of town A = 5000, growth rate of town A = 4%, population of town B = 8000, and growth rate of town B = 2%.)


1
Expert's answer
2022-02-05T14:56:41-0500




pseucode 
Declare Integer popA
Declare Integer popB
Declare Integer year
Declare Real growA
Declare Real growB


Display "Enter the population of town A: "
Input popA
Display "Enter the population of town B: "
Input popB
Display "Enter growth rate in percent of town A: "
Input growA
Display "Enter growth rate in percent of town B "
Input growB
Set year = 0
If popA <= popB AND growA > growB Then
    Do
        Set popA = growA / 100 * popA + popA
        Set popB = growB / 100 * popB + popB
        Set year = year + 1
    While popA <= popB
    Display "The Population of town A After ", year, " years is ", popA
    Display "The Population of town B After ", year, " years is ", popB
Else
    Display "Does Not Compute"
End If

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog