Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 (9 points): Purpose: To practice using various kinds of loops (and do some science at the same time!) Degree of Difficulty: The coding

image text in transcribedimage text in transcribed

Question 2 (9 points): Purpose: To practice using various kinds of loops (and do some science at the same time!) Degree of Difficulty: The coding here is Easy. But read the description carefully! When scientists, economists, or business analysts seek to understand a complex dynamic process, they might develop a simplified mathematical model which they can use to understand the complex system. In this question, we'll draw on a simple model from biology (but spiced up with Pokemon, obviously), but from this example, you can imagine how to do similar studies in any field The model Koffing is a poisonous pokemon that releases toxic gasses. The evil Team Rocket is trying to breed Koffings in a lab, with the intent to use them as biological weapons! The Koffings are being grown in a giant test tube. The population of Koffings in the tube increases and decreases over time depending on two factors: 1) how large the current population is, and 2) how quickly the Koffings reproduce. We'll model the total population using a floating point number in the range from O (meaning extinct) to 1 (meaning the maximum population that can fit in the test tube). We will model time using an integer counter that starts at O, and increases by 1 up to some preset limit given by the user. In this model, time is abstract: we are simply counting time steps, assuming that each step is the same duration, but without committing to seconds, or hours, or years. Suppose that the population at time t is p. Our simple model predicts that the population one time step later, i.e. att + 1, is (r px (1-p), where ris a real number in the model that represents how the population of Koffings changes in a single time-step (i.e. r is the rate of change). The value r does not change Sample Run: Console output Sample input and output (input typed by the user is shown in green text) How many time steps to simulate? 5 What 's the rate of change? 2.7 What 's the starting population? 0.3 Time Population 0 0.3 1 0.567 2 0.6628797000000001 3 0.603369548985357 4 0.6461497881249225 5 0.6173286464638088 This sample run is very very short, because a longer run would take up too much space on a page. You can check your program by using the values above, but see below for more information about demonstrating your program. Program requirements Prompt the user to enter the initial population. You must make sure that the user enters a floating point number between O and 1 (inclusive). If they do not enter a value in the correct range, print a message informing them so, and prompt them to enter the value again. Keep doing this until they enter an acceptable value. You may assume the user will enter a number; you don't have to check that it is a number

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_2

Step: 3

blur-text-image_3

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago