CS 1400 Fundamentals of Programming

Programming Project 7: Rabbits, Rabbits, Rabbits


At the completion of this project, you will have created a console application that


This is another problem solving project. Since I want you to focus on the algorithm part of the problem, you should write this as a Console Program. Once you have figured out the steps required to solve the problem, writing the code should be pretty easy. You should be pretty familiar with doing these steps by now:

  1. Write down everything that you know about the problem
  2. Draw pictures to help you visualize the problem
  3. Write down what it is that your program needs to compute
  4. Write down any formulas, equations, or relationships that you might find useful
  5. Create an Activity Diagram and Pseudo-code. Then use the activity diagram and the pseudo-code as the basis for writing the code that you submit.

Suppose that a scientist is doing some important research work that requires her to use rabbits in her experiments. She starts out with one pair of adult rabbits (a male and a female). At the end of each month, a pair of rabbits produces one pair of offspring (a male and a female). However, these new offspring will not be able to reproduce until they are a month old, and won't have babies of their own until the following month. To illustrate this, consider the first two months:

At the beginning of month one, the scientist just has the original pair of adult rabbits. The table for month one will look something like

Month Adults Babies Total
1      1      0      1

At the end of month one this pair of adults produces one pair of offspring. Thus, at the beginning of month two the table will look like this:

Month Adults Babies Total
1      1      0      1
2      1      1      2

At the end of month two the adults have another pair of baby rabbits. The first pair of babies, born at the end of last month are not old enough to have babies yet, but we will categorize them as adults. So, at the beginning of month three the table looks like this:

Month Adults Babies Total
1      1      0      1
2      1      1      2
3      2      1      3

The scientist has 500 cages in which to hold her rabbits. Each cage holds one pair of rabbits. Assuming that no rabbits ever die, when will she run out of cages?

Your program must do the following:

  1. Print out your student information.
  2. Print a table that contains the following information for the beginning of each month. Stop printing when you run out of cages.
  3. Calculate and print out how many months it will take until the number of rabbits exceeds the number of available cages.

Format and document your code in accordance with the course style guidelines.  Include a file prologue identifying you as the author.  Also include an electronic version of you Activity Diagram. Diagrams may be done in Word, or scanned in and sent as an image file. Submit your project using the instructions outlined in the Course Syllabus, Programming Projects section.

File(s) to Submit:

Place your complete project folder into a zip file and name the zip file
proj_07_your-initials_V1.0.zip. For example, I would name my file proj_07_RKD_V1.0.zip. Submit this assignment as Project #7 on Canvas.


If you need help solving this problem, you can find some hints here.

Grading Criteria

Description Points possible Your points

Project meets the following guidelines:
o Source code files contain a declaration that you did not copy any code
o Project has been submitted to Canvas
o Code is properly documented, including pseudo-code
o Code meets style guidelines


Your program produces a table as shown in the sample output.


The data in the table is correctly calculated using a loop.


You have noted in which month the number of rabbits exceeds the number of cages. Note that this value must be calculated by your program.


Early bonus (+3 pts) or late penalty (20%/day)




Sample Output:

Problem 4 output

You can get an executable that runs correctly here!