Purchase Solution

Modularity - C++ Program

Not what you're looking for?

Ask Custom Question

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
Documentation
Header documentation (programmer info) 5 Points
Input
User-prompted data 15 Points
Output
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
Method
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

Purchase this Solution

Solution Summary

The expert examines modularity for C++ programming.

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Javscript Basics

Quiz on basics of javascript programming language.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Networking Questions

This quiz consists of some basic networking questions.