Explore BrainMass

Modularity - C++ Program

A farmer has a bunny farm. He has cage capacity for a limited number of bunnies. A pair of adult bunnies will give birth to 2 bunnies (1 male and 1 female) at the end of every three months. A bunny is an adult when he or she reaches the age of 4 months. (i.e. 1st pair at age 3 months give birth to1 male and 1 female at the end of the 4th month). For example:
Number of months Number of bunnies
0 2
3 4
6 8
9 16
12 32
and so on..........

Write a complete C++ program to do the following:

1. Prompt the user to enter the total capacity of the cage.
2. Determine when the farmer will have to separate the bunnies in order to prevent the birth of any more.
3. Convert the above time in months to years and months.
4. Determine the number of bunnies that could still be accommodated in the cage when the bunnies were separated.
5. Prompt the user to input a time (in months) to check how many bunnies are present at a given time.
6. Print your results as indicated on the next page.
Save your program as bunny_world.cpp

Program 8 will be worth 100 points and will be assigned points as follows:
Program compiles 20 Points
Header documentation (programmer info) 5 Points
User-prompted data 15 Points
Personal Information 5 Points
Capacity of cage 5 Points
Number of months when cage is full 5 Points
Full capacity reached in years and months 5 Points
Remaining space available at time of separation 5 Points
Number of bunnies in cage at a specified time 5 Points
Functions as directed 30 Points
Total 100 Points

In addition to the usual programmer statements your output should include the following:

Your cage can hold number of bunnies.
In months you will have to separate the boy bunnies from the girl bunnies.
This is the same as years and months.
When the males and females are separated your cage will still be able to accommodate extra bunnies.
After time you will have bunnies in the cage.

Tip: The items in color represent values your program is to either input or calculate and print.

BONUS: If you can correctly write this program using functions for any or all of the following, you can receive extra credit. I will award 5 extra points for any of the following done correctly using functions. Remember, you may or may not have to pass data for any or all of these. If you cannot do all of them, try any that you can do.

 Printing of Programmer information
 Cage size (prompt to user and storage of input to be used by program)
 When bunnies will have to be separated
 Months to years and months conversion
 Number of extra bunnies your cage can hold after bunnies are separated