Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C# The population of a town A is less than the population of town B. However, the population of town A is growing faster

In C#

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 5,000, growth rate of town A 2.5%, population

of town B 8,000, and growth rate of town B 1.1%.)

image text in transcribed
Declare variables to hold pop, grate for town A Repeat for town B Accept input for all (be carful with % or dec grate 2.5 % or 0.025) Before we construct the loop check if pop A is less than B && grate of A> grate of B Assume that step above is true Declare an int years year, myYear Construct your sentinel loop (condition -> ??) In the body of the loop: increment year by 1; PORA - popA + RORA grate for A; same for RRR When loop exits, output year, ReRA, popB. +

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions