I'm in a intro to computer science course and are HW assignment is to create a program to simulate a rabbit population over so many months. I am having trouble with the part where I determine the gender of each rabbit for more than the first month. Here's what I have for determining gender...
public class TestMath
public static void main( String args )
int mAdult = 0;
int fAdult = 0;
int mBaby = 1;
int fBaby = 1
int count = 1;
int newBabies = fAdult + fbaby ;
int month = 15;
//determine gender for each baby rabbit
while ( count <= newBabies )
double r = Math.random();
if ( r < .5)
System.out.printf( "mAdult: %d\fAdult: %d", mAdult, fAdult);
So that determines the gender of the rabbits after 1 month, but say I want to do it for 15 months. The assignment says each female rabbit produces 2 babies each month and after 1 month a baby becomes an adult. How would I do this for any number of months and then display the population?