Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!