Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started