Assignment on transient population

Assignment Help Basic Computer Science
Reference no: EM132781566

Transient Population

The starting size of a population PB

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 annual birth rate (as a percentage of the population expressed as a fraction in decimal form)
  • The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D
  • The average annual number of people who have arrived A
  • The average annual number of people who have moved away M
  • The number of years to display nYears

Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formula

N = P + BP - DP + A - M

where N is the new population size, P is the previous population size, and B, D, A and M are as defined above. The function should return the value computed for N and should receive the values of P, B, D, A and M as parameters.Prompts And Output Labels. The program first displays the message "This program calculates population change." on a line by itself, followed by these prompts for the inputs described above:     "Enter the starting population size: "

"Enter the annual birth rate (as % of current population): "

"Enter the annual death rate (as % of current population): "

"How many individuals move into the area each year? ";

"How many individuals leave the area each year? ";

"For how many years do you wish to view population changes? "

The output of the program starts with a line:

Starting population: P (where P is the starting population (surprise)), and then continues with a separate line for each year, each line being of the form: Population at the end of year ||Y is P. (where Y is the year number (1,2,3,...) starting with 1, and where P is the population calculated for that year).

Input Validation. The program should validate all data read. None of the data should be negative, the number of years should not be less than 1 and the initial population should not be less than 2. If an invalid value is read, the program should print an error-specific message on a line by itself, followed by the directive "Please re-enter:" and then input another value-- until a valid value is entered. The error specific messages are: "Starting population must be 2 or more.", "Birth rate percent cannot be negative.", "Death rate percent cannot be negative.", "Arrivals cannot be negative.", "Departures cannot be negative.", and "Years must be one or more."

Reference no: EM132781566

Questions Cloud

The organization supply chain characteristics : The organization's supply chain characteristics - type of supply chain, negotiations strategies, performance of the supply chain, and areas for improvement.
How ethical concerns were addressed and acknowledges : By now, you should be aware that the findings from a research study are only part of the story. As a consumer, hoping to inform practice by use of an evidence.
Undesirable activity from a manager perspective : Is monitoring an employee's work on a computer a desirable or undesirable activity from a manager's perspective?
How much total interest austal ship needs to pay : Austal Ship also forecasts 3.76%, 4.43%, and 4.71% LIBOR in year1, year2, and year3, respectively. How much total interest Austal Ship needs to pay
Assignment on 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
Evaluate trends in stock price : Evaluate trends in stock price, dividend payout, and total stockholders' equity. Relate recent events or market conditions to the trends you identified.
Improvement opportunity- quality tool analysis : Write on improvement opportunity in your sphere of influence. Identify your problem statement and complete a root-cause analysis.
Explain four principle of digital evidence : Briefly explain four principle of digital evidence that always been a guideline in identifying potential evidence.
Establish marketing objectives based on the results : Establish marketing objectives based on the results from the SWOT analysis. Marketing objectives must align with corporate objectives

Reviews

Write a Review

Basic Computer Science Questions & Answers

  What does the push transition do in powerpoint presentation

What does the "Push" transition do in a PowerPoint Presentation

  How good you are with python programming

How good you are with Python Programming? Are you familiar with Hackerrank assignments for Python?

  Poorer segment of the population

Tax cut is a debatable topic. Does it help or hurt the relatively poorer segment of the population?

  What is the expected number of floors the elevator stops

What is the expected number of floors the elevator stops

  Point out which following functions exist and which cannot

Point out which of the following functions can exist and which cannot. Provide either reasons for functions that cannot exist, or examples for functions that can exist a. A bijection from Ø to 2^Ø b. A bijection from ? to ?

  Hardware affect this advantage

Write a 200- to 300-word short answer response that addresses the following: What competitive advantage does technology give to business? How does aging hardware affect this advantage?

  Examples of societal problems are unemployment-pollution

"Examples of societal problems are unemployment, pollution, water quality, safety, criminality, well-being, health, and immigration."

  Different packet transmission order

1) It is possible to define flows on either a host-to-host vasis or on a process-to-process basis. Describe the implications of both. 2) Give an example of how nonpreemption in the implementation of fair queuing leads to a different packet transm..

  Limited number of drilling rigs

Now suppose that the company has a limited number of drilling rigs extracting oil at Alaskan sites and at other sites in the United States.

  How content from it can be used in your professional career

Summary reflecting on how content from it can be used in your professional career.

  When looking at gnatt chart in project manager

When looking at Gnatt chart in Project manager, can yu tell me how to check for over-allocation?

  Find an article on the Internet outline security breach

Find an article on the Internet outline a security breach or cyber attack. Provide a link to the article, what type of attack was used,

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd