Question

C# Develop a form that allows the user to project the population of your city for...

C#

Develop a form that allows the user to project the population of your city for a specific number of years and growth rate. Allow the user to specify the current year's population, the number of years and the annual growth rate. Use a FOR loop to compute and display each year, starting with the current year and the corresponding population

State any assumption made.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Population
{
class Program
{
static void Main(string[] args)
{
int currentYearPopulation,numberYears;
double growthRate,population;

population = 0.0;

Console.Write("Enter the current year population: ");
currentYearPopulation = Convert.ToInt32((Console.ReadLine()));

Console.Write("\nEnter the number of years: ");
numberYears = Convert.ToInt32(Console.ReadLine());

Console.Write("\nEnter the annual growth rate: ");
growthRate = Convert.ToDouble(Console.ReadLine());

population = currentYearPopulation;

Console.WriteLine("\n\nYear\tPopulation");
Console.WriteLine("------------------------");
for (int i = 1; i <= numberYears; i++)
{
Console.Write(i+"\t");
Console.WriteLine(Math.Round(population));
population = population + population * (growthRate/100);
}

Console.ReadKey();
}
}
}

Output:

Add a comment
Know the answer?
Add Answer to:
C# Develop a form that allows the user to project the population of your city for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++ Transient Population Populations are effected by the birth and death rate, as well as...

    In C++ Transient Population Populations are effected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size...

  • 5.41 exercise Visual C#:How to Program (World Population Growth) World population has grown considerably over the...

    5.41 exercise Visual C#:How to Program (World Population Growth) World population has grown considerably over the centuries. Continued growth could eventually challenge the limits of breathable air, drinkable water, arable cropland and other limited resources. There's evidence that growth has been slowing in recent years and that world population could peak sometime this century, then start to decline. For this exercise, research world population growth issues online. Be sure to investigate various viewpoints. Get estimates for the current world population...

  • Your task for this project is to write a parser for a customer form. You need to develop a Java a...

       Your task for this project is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors. Remember that your fifth and sixth assignments are very similar to this project and you can benefit from them. The customer form should include the following structure: First name, middle name (optional), last name Street address, city, state (or...

  • P3.4 Population. In a population, the birth rate is the percentage increase of the population due...

    P3.4 Population. In a population, the birth rate is the percentage increase of the population due to births, and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population The annual birth rate The annual death rate The number of years to display Write a function that calculates...

  • Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for...

    Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for program with ALL conditions met. Conditions to be met: Word Problem A person inherits a large amount of money. The person wants to invest it. He also has to withdraw it annually. How many years will it take him/her to spend all of the investment that earns at a 7% annual interest rate? Note that he/she needs to withdraw $40,000.00 a year. Also there...

  • Need help completing these three programs using Raptor. Any help is appreciated. What to Submit: Complete...

    Need help completing these three programs using Raptor. Any help is appreciated. What to Submit: Complete the following three programs in Raptor and submit the three .rap files Program 1 Budget Analysis (50 points): Design a program that asks user enter the amount he/she has budgeted for a month. And then use a loop to prompt the user enter each of his/her expenses for the month, and keep a running total. When the loop ends, the program should display budgeted...

  • Winter 2019 Math 131-02 Project 1- Exponential Growth Finding the current price or quantity of something,...

    Winter 2019 Math 131-02 Project 1- Exponential Growth Finding the current price or quantity of something, and find its recent annual growth rate expressed as a perceet. You may use the Internet or use a book or periodical. For instance, you might find that the median house price in some area is siso and is growing at about 4.1% per year, or you might find that tuition in a state averages $8000 and is growing at 63% per year. Once...

  • C++ ONLY The question is - The US Census Bureau gathers population information and aggregates it...

    C++ ONLY The question is - The US Census Bureau gathers population information and aggregates it at the city, county and state level. A research project on population distribution in the Southeast US has acquired a data file from the Census Bureau that contains the populations of each county in Mississippi (MS) and Florida (FL). For this research project write a program that calculates the average county population for these two states. Each line in the Census Bureau data file...

  • Java

    Create a Java class (program) called PopulationGrowth.java. This program will compute the growth rates of a population over time. The program should take the following inputs from the user:p, the initial population size in the range [1...1000]b, the per capita birth rate in the range [0.0...1.0)d, the per capita death rate in the range [0.0...1.0)time_span, the number of years for which to compute population totalsOnce the input is finished, the program must compute the population for the next time_span years and display each...

  • C# Create an application that will allow a loan amount, interest rate, and number of finance...

    C# Create an application that will allow a loan amount, interest rate, and number of finance years to be entered for a given loan. Determine the monthly payment amount. Calculate how much interest will be paid over the life of the loan. Display an amortization schedule showing the new balance after each payment is made. Design an object-oriented solution. Use two classes. Loan class: characteristics such as the amount to be financed, rate of interest, period of time for the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT