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.

I really need help with this program, I'm not sure exactly how to start.

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.

You will probably get NO useful responses by spamming this board with your homework assignments. Since you did not as a question I suppose you expect somebody to do the work for you.

I don't understand how to get this program to work and no I wasn't expecting someone to do my homework. I just need someone to point me in the right direction or give some pointers on how to get it to work.

Then why did you start a new thread?

start here.

#include <stdio.h>

int main()
{
  // put your code here
  return 0;
}

You may want to work through the program math on paper before starting to code so that you understand the math part.

thanks

Do I need to put a table or can I get the results I want without one?

>> Do I need to put a table or can I get the results I want without one?

Don't know -- since the problem doesn't say one way or the other I suppose you can do it however you want.

Ok well I'm kinda stuck and not real sure how to determine when the farmer will have to seperate the bunnies in order to prevent the birth of any more....Here is what i have so far:
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
int num1;
cout <<"Months Bunnies\n";
cout <<"0 2\n";
cout <<"3 4\n";
cout <<"6 8\n";
cout <<"9 16\n";
cout <<"12 32\n";
cout <<"Enter Total Capacity of Cage\n";
cin >>num1;
}

>>to determine when the farmer will have to seperate the bunnies i

when full capacity is reached. If the capacity is 1,000 rabbits then that is when the males have to be separated from the females, or when you have to casterate all the males.

ok did what i have so far look right

>>id what i have so far look right
does it do what you want it to do? If yes, then it is correct.

<<threads merged>>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.