Prompt the user to enter the total capacity of the cage


Assignment:

Q: 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..........

Create 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.

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

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Prompt the user to enter the total capacity of the cage
Reference No:- TGS01937797

Now Priced at $25 (50% Discount)

Recommended (95%)

Rated (4.7/5)