Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to perform an ecological simulation involving rabbits and wolves

ID: 3616577 • Letter: W

Question

Write a program to perform an ecological simulation involving rabbits and wolves.

The basic biological facts are that wolves eat rabbits and rabbits eat grass.  Both breed, although rabbits are much faster.  There is plenty of grass, so wolves are the only obstacle to the population increase of rabbits.  The wolf supply increases with the supply of rabbits.  The day-to-day changes in the rabbit population (r) and the wolf population (w) can be expressed via the following formulas:

                        r  (tomorrow) = (1 + A) * r  -  C * r * w   (today)

                        w (tomorrow) = (1 - B) * w  +  C * D * r * w   (today)   

where

                        A = 0.01                      represents the fractional increase in rabbit population with no competition.  

                        B = 0.005                    represents the fractional decrease in wolf population with no rabbits to eat.

                        C = 0.00001                represents the likelihood that a wolf will encounter and eat a rabbit.

                        D = 0.01                      represents the fractional increase in wolf population attributed to an eaten rabbit.

Write your program to monitor the daily fluctuations of rabbits and wolves over a 1,000 day period.  Print out the results, both to an output file and to the screen, every 25 days.  Read in the initial number of rabbits and wolves from the keyboard.

Your output must look like the following:

Initial number of rabbits = 10000

Initial number of wolves  = 1000

   Day          Rabbits          Wolves

    25          XXXXXXX         XXXXXXX

    50          XXXXXXX         XXXXXXX

  etc.            etc.            etc.

  1000          XXXXXXX         XXXXXXX                 

Maximum number of rabbits = 210504

Maximum number of wolves  = 2949

Notes

1.         To determine if it is the 25th day, use the "%" operator.  That is, use a statement like

                        if (day % 25 == 0)

Explanation / Answer

please rate - thanks I get different maximums--but I can't find anything wrong, checkwith others what they get #include #include using namespace std; #define A .01 #define B .005 #define C .00001 #define D .01 #define days 1000 int main() {int i; int r,w,maxr=0,maxw=0; ofstream output; output.open("output.txt");          //open file coutr; coutw; output
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote