We have to write some code to simulate rabbits population growth in Australia. We have determined that the rabbit population doubles every month. For example month 1- 2 rabbits, month 2 –4 rabbits, month 3 – 8 rabbits … We also have some dingo dogs who eat rabbits and who also increases in population. Each dingo dog eats 4 rabbits each month. The dingo population doubles every 6 months. (assume no deaths in dingoes, no one eats a dingo dog) I want to know how many rabbits and how many dingo dogs exist after 4 years. Our initial population of rabbits is 14 and our initial population of dingo dogs is 2. Write the code to compute these population values after 4 years.
Code
#include<iostream>
using namespace std;
int main()
{
int rabbits = 14, dogs = 2;
for (int i = 1; i <= 12*4; i++)
{
if (i % 6 == 0)
dogs = dogs*
2;
rabbits = rabbits * 2;
rabbits = rabbits - (4 *
dogs);
}
cout << "After 4 years population of rabbits
are: " << rabbits << endl;
cout << "After 4 years population of dogs are: "
<< dogs << endl;
system("pause");
return 1;
}
output
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
We have to write some code to simulate rabbits population growth in Australia. We have determined...
Population Growth: Let P(t) be the number of rabbits in the rabbit population. In the simplest case we can assume the number of rabbits born at any moment of time is proportional to the number of rabbits at this moment of time. Mathematically we can write this as a differential equation: Here b is the birth rate, i.e. births per time unit per rabbit. In the model above we ignore deaths and assume resources are unlimited. A. Solve the equation...
Compute a Matlab script: Suppose we have two species of animals, foxes and rabbits and we wish to model their population Suppose the number of foxes at a given time is given by yn and the number of rabbits is given by rn. Suppose in the absence of predation, rabbits reproduce at a rate proportional to their population rn with constant of proportionality a. Suppose the rate at which foxes eat rabbits is proportional to the number of foxes with...
Using C++ program please HAND IN LABORATORY TASK: #17( if you get an A grade your earn 20pts for AVG) FOX HEAVEN an island off the coast of Costa Rica near Isla Sorna (REPORTS OF STRANGE CREATURES ON THIS ISLAND) Write a program to study the population of foxes ON Fox Heaven Island as the years go by with the following conditions. BE SURE TO DOA FLOW CHART FIRST AND HAND IN WITH THE PROGRAM You study the island and...
R CODE PROGRAM 1. Suppose we want to simulate an experiment that can take outcomes 1; : : : ; n with probabilies p1; : : : ; pn. To be specic, suppose the R-vector p=c(.1,.2,.3,.35, .02, .03) gives the desired probabilities. Write R code that produces a number from 1 to 6 with the given probabilities, without using if statements. I recommend using the R command cumsum to do this, though there many possible approaches. 2. Suppose we are...
Write a program in either C++ or Java meeting these requirements Description: In this program, we assume that our data comes in dynamically. We need to maintain our data in a heap, after every insertion and deletion. We also need to handle the underlying array dynamically. whenever we detect an overflow in our array, we will create a new array with size doubling the previous size. Requirements: 1. (Dynamic Data) when we generate the data, we simulate dynamic data. We...
Suppose we have two species R and S that interact with one another and that we record the change in their populations from year to year. When we begin our study, the populations, measured in thousands, are Ro and So; after k years, the populations are R and S,. If we know the populations in one year, they are determined in the following year by the expressions We will combine the populations in a vector x - and note that...
Assume we already have an ArrayList of Integers called list. Write code that will add 1 to each element of the list. For example, if the list originally contained 2, 4,-3, then it should contain 3, 5, -2 after the lines of code execute. Just write the necessary lines of code (not a whole method or program). Assume we already created the ArrayList and filled it with Integers.
*JAVA* Assume we already have an ArrayList of Integers called list. Write code that will add 1 to each element of the list. For example, if the list originally contained 2, 4, -3, then it should contain 3, 5, -2 after the lines of code execute. Just write the necessary lines of code (not a whole method or program). Assume we already created the ArrayList and filled it with Integers.
We have a population of 100 breast cancer patients of which half have received some form of treatment (i.e. chemo, radiation, etc). Use this information to answer the following questions a. If X represents the number of breast cancer patients who have received treatment in the sample, what distribution it follows? b. If we sample 10 patients, how likely will 4 have received treatment? c. If we sample 25 patients, how likely will 5 have received treatment? d. If we...
For Python Instructions A local biologist needs a program to predict population growth. The inputs would be: 1. The initial number of organisms 2. The rate of growth (a real number greater than 1) 3. The number of hours it takes to achieve this rate 4. A number of hours during which the pq, ulation grows For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate...