public void update(World w)
  {
    repaint();
    currGeneration = w.getGeneration();
    int nxtPopulation = w.getPopulation();
    double growthRate = 0.0, deathRate = 0.0;
    if (currGeneration == 0)
    {
      maxPopulation = nxtPopulation;
      minPopulation = nxtPopulation;
    }
    else
    {
      growthRate = ((nxtPopulation - currPopulation)*1.0) / (currPopulation*1.0);
      deathRate = -growthRate;
      if (nxtPopulation > maxPopulation) maxPopulation = nxtPopulation;
      if (nxtPopulation < minPopulation) minPopulation = nxtPopulation;
      if (growthRate > maxGrowthRate) maxGrowthRate = growthRate;
      if (deathRate > maxDeathRate) maxDeathRate = deathRate;
    }

    //updates start here
    genLabel.setText("Generation: " + currGeneration);
    popLabel.setText("Population: " + currPopulation);
    maxPopLabel.setText("Maximum population: " + maxPopulation);
    minPopLabel.setText("Minimum population: " + minPopulation);
    maxGrowthLabel.setText("Maximum growth rate: " + Math.round(maxGrowthRate*100000.00)/100000.00);
    maxDeathLabel.setText("Maximum death rate: " + Math.round(maxDeathRate*100000.00)/100000.00);
   
    population.addDataPoint((double)nxtPopulation);
    popChange.addDataPoint((double)nxtPopulation - currPopulation);
    growDeathRate.addDataPoint(Math.max(growthRate,deathRate));

    currPopulation = nxtPopulation;
  }