Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write program in c++ that simulates a population of bunny rabbits in real-time using the follow set of criteria: At program initialization 5 bunnies must

Write program in c++ that simulates a population of bunny rabbits in real-time using the follow set of criteria:

  • At program initialization 5 bunnies must be created and given random colours.
  • Each turn bunnies age by 1 year.
  • Bunnies die when they reach 10 years of age
  • If there is at least one adult male (aged 2+), every adult female gives birth to a new bunny, e.g. if there was 1 adult male and 3 adult females, 3 new bunnies would be born
  • New bunnies are born with the same colour as their mother
  • The program should print a list of all the bunnies in the colony each turn giving all the bunnies details, sorted by age.
  • Each turn lasts 2 seconds and there should be a 1 second pause for announcements
  • When all bunnies have died the program terminates

If the population exceeds 50, a food shortage occurs killing exactly half of the bunnies chosen at random

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

=+b. Product-Focused emphasize product features.

Answered: 1 week ago

Question

1. What might have led to the misinformation?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago