Hi everyone! I'm new here this is my first post and woe is me its a call to anyone willing to help me! I'm in an introduction course to java at school and I have programed a little in the past, but nothing to write home about. Today my instructor assigned a program and I have typed up the skeleton for it, and now I am just staring at my compiler watching the cursor blink I honestly have no clue where to go from here

We aren't very far into java yet so I can't use any loops or arrays or any of the fancies. I basically just have if statements.

here is the assignment:

Write a computer program to simulate the growth of a rabbit population in New Zealand. The rules that govern the population are as follows: Start with n pairs of rabbits of different sexes. The rabbits are able to mate at age of one month. A month later, each female produces two new rabbits. The probability that a new born rabbit is a female is the same as the probability that the rabbit is a male. You may assume that the rabbits never die and that the female always produce two new rabbits every month from the second month on. Your program will provide the software for observing the rabbit population in m months after the n pairs of rabbits are introduced to the island in New Zealand.
Your program should include two classes, RabbitPopulation and TestRabbitPopulation. The RabbitPopulation class should have two constructors. One "default" constructor will set the initial population to be a pair of baby rabbits that are less than one month old (one female and one male). The second constructor will set the population to include n pairs of baby rabbits (n female and n male). The value of n is to be passed through the caller of the constructor. The RabbitPopulation class should include at least five methods, waitAMonth that waits a month (the sex of any new born in the month to be determined by a random number, use Math.Random), getFemaleBabyRabbits that returns the number of female baby rabbits, getMaleBabyRabbits that returns the number of male baby rabbits, getFemaleAdultRabbits that returns the number of female adult rabbits that is at least one month old, and getMaleAdultRabbits that returns the number of male adult rabbits.
The main method of TestRabbitPopulation class should show the growth of the rabbit population after m months. You should run your simulation for at least 3 times, each with different values of n and m. Copy your outputs for (n=1, m =10), (n=6, m=20), (n=10, m=30) to a file

and here is what i have done so far:
my RabbitPopulation class

public class RabbitPopulation
{

	int babyM = 0;
	int babyF = 0;
	int adultM = 0;
	int adultF = 0;
	double love;
	
	public RabbitPopulation()
	{
	
	}
	
	public RabbitPopulation(int a)
	{
	babyM = a;
	babyF = a;
	}
	
	public void waitAMonth()
	{

	/* this is junk doesnt do anything helpful I dont think
		if (adultF>=1)
		{
		babyM++;
		babyF++;
		}
		*/
		
	}
	
	public int getFemaleBabyRabbits()
	{
	return babyF;
	}
	
	public int getMaleBabyRabbits()
	{
	return babyM;
	}
	
	public int getFemaleAdultRabbits()
	{
	return adultF;
	}
	
	public int getMaleAdultRabbits()
	{
	return adultM;
	}
}

and my tester class. the print statement there was to see if
my methods worked at all ^.^

public class testRabbitPopulation
{
	public static void main(String[] args)
	{

	RabbitPopulation bunny = new RabbitPopulation();

	System.out.println("Enter number of pairs of rabbits: ");

	System.out.println(bunny.getFemaleBabyRabbits());
	
	}
}

I'm not asking for someone to write my program just nudge me in a direction. I'm having trouble with the waitAMonth method, trying to figure out how to increase everything and use the Math.random().... thinking about it all at once makes my head hurt

so if anyone is willing to read my massive post and offer any help that would make this rabbit induced headache go away!

Thanks everyone

First two basic examples.
-How to exchange values between two varibles a and b?
Store one if them in temp.
temp=a;
a=b;
b=temp;
This method prevents the loss of information.

- Write class Counter with one varible int count,
constructor Counter(int count) and method

int getNext(){
    int result = count;
    // on input current (old) state of var. count
    result = result + 1;
    count = result; // modification of class var. count

    // on output new state of var. count
    return count;
}

Each invocation of getNext() changes state of this class
Method get() do not change state :

int get(){
    // on output current state of var. count
    return count;
}

Counter can count all, that is numerable (seconds, months, balls..)
then start your population

public static void main(String[] args) {
        System.out.println("Enter number of pairs of rabbits: ");
        int babyPair = 1;
        System.out.println(babyPair);
        RabbitPopulation bunny = new RabbitPopulation(babyPair);
        // there time is zero
        // check bunny population
        System.out.println(bunny.toString());
// babyM = 1       babyF = 1      adultM = 0     adultF = 0

        bunny.waitAMonth();
        // one month passes

        // check bunny population
        System.out.println(bunny.toString());

// babyM = ?       babyF = ?      adultM = ?     adultF = ?

    }

with

public void waitAMonth() {
        //babyM
        //babyF
        //adultM
        //adultF
        // use, but do not modify this values
        // temporaily introduce your own 
        // 
        // hiere is month later 
//1.The rabbits are able to mate at age of one month. 
//2.A month later, each female (adultF) produces two new rabbits. 
//3.The probability that a new born rabbit is a female is the same as the probability that the rabbit is a male. 
        // calculate all temporaily values you need (points 1. 2. 3.)
        //
        // now you can substitute/modify this values 
        //babyM =
        //babyF =
        //adultM =
        //adultF =
    }
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.