Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the C++ programming language, write a program that simulates a colony of bunny rabbits. Each bunny object must have the following data members: -

Using the C++ programming language, write a program that simulates a colony of bunny rabbits. Each bunny object must have the following data members:

- sex: Male, Female (random at creation 50/50) -

color: white, brown, black, spotted -

age: 0-10 (years old) -

name: randomly chosen at creation from a list of bunny names

- radioactive_mutant_vampire_bunny: true/false (decided at time of bunny creation with 2% probability)

At program initialization, 5 bunnies must be created and given random colors. During each pass afterwards, the bunnies age by 1 year. So long as there is at least one male bunny aged 2 or older, a new bunny is created for each female bunny aged 2 or older. For example, if there is one adult male and three adult females, three new bunnies would be born. New bunnies born should be the same color as their mother. If a bunny becomes older than 10 years old, it dies. If a radioactive mutant vampire bunny is born then it will change exactly one non radioactive bunny into a radioactive vampire bunny. If there are two radioactive mutant vampire bunnies two bunnies will be changed each pass and so on. Radioactive vampire bunnies are excluded from regular breeding and do not count as adult bunnies. They do not die until they reach age 50. D

uring each pass, the program should

output a list of all the bunnies in the colony along with all the bunnies details, sorted by age

output each of the events for a pass, such as Bunny Thumper was born! Bunny Fufu was born! Radioactive Mutant Vampire Bunny Darth Maul was born! Bunny Julius Caesar died! write all screen output to a file.

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

In problem, solve each equation. ln e -2x = 8

Answered: 1 week ago