# solution

The population follows the Fibonacci sequence, in which the current population is the sum of the previous two years’ populations. Assume it starts out with value 1 for the last year’s population and 0 for the year before that, so that the initial population is also 1 + 0 = 1. For example, the values would look like this for the first few years:

 Initial values: last year 1 year before 0 population 1 = 1 + 0
 After one year: last year 1 year before 1 population 2 = 1 + 1
 After two years: last year 2 year before 1 population 3 = 2 + 1
 After three years: last year 3 year before 2 population 5 = 3 + 2

To get this working, you’ll just need two extra instance variables (for example, lastYear and yearBefore) that are updated as indicated in the sample values above

using this code

public class RabbitModel5 {

private int population;
private int lastYear;
private int yearBefore;

public RabbitModel5()
{
lastYear = 1;
yearBefore = 0;
population = 0;
}

public int getPopulation()
{
return population;
}

public void simulateYear()
{

}

public void reset()
{

}
}