Answer to Question #297228 in Algorithms for Eden

Question #297228

The population of a town A is less than the population of town B.However, the population of



algorithmoutputs after how many years the population of town A will be greater than or equal to



flowchartthat prompts the user to enter the population and growth rate of each town. The



Population of town A =5000, growth rate of town A = 4%, populationof town B = 8000, and



town A is growing faster than the population of town B. Write algorithm usingpseudocodeand



the population of town B and the populations of both the towns at that time. (A sample input is:



growth rate of town B =2%)

1
Expert's answer
2022-02-13T11:07:28-0500
function main()
    output "Enter the population of town A: "
    input populationTownA
    output "Enter the population of town B: "
    input populationTownB
    output "Enter growth rate in percent of town A: "
    input growTownA
    output "Enter growth rate in percent of town B "
    input growTownB
    year = 0
    if populationTownA <= populationTownB AND growTownA > growTownB then
        loop
            populationTownA = growTownA / 100 * populationTownA + populationTownA
            populationTownB = growTownB / 100 * populationTownB + populationTownB
            year = year + 1
            while populationTownA <= populationTownB
        end loop
        output "The Population of town A After " + year + " years is " + populationTownA
        output "The Population of town B After " + year + " years is " + populationTownB
    else
        output "Wrong data"
    end If
end function

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
APPROVED BY CLIENTS