
import java.text.DecimalFormat;
public class SpeciesFirstTry_1
{
    public String name;
    public int population;
    public double growthRate;

    public SpeciesFirstTry_1( String n, int pop, double growth )
    {
         name = n;
         population = pop;
         growthRate = growth;
         //return this pointer
    }
 
    public void writeOutput()
    {
         System.out.println("Name = " + name);
         System.out.println("Population = " + population);
         System.out.println("Growth rate = " + growthRate + "%");
    }

       
    public static int NUMCONTINENTS = 6;
    public void showLandPortion( ) 
    {
      if( population == 0 ) {
        
          System.out.println( "Population is zero." );
          return; //end here to avoid division by Zero 
        }
        
      double fraction =  population / ((double)NUMCONTINENTS);
      DecimalFormat wholeNumber = new DecimalFormat( "#,###" );
      // Easier way?
      
      System.out.println( "If the population were spread over " + NUMCONTINENTS 
      + " continents,\nthen each continent would have  " + wholeNumber.format(fraction)
      + " species of the worldwide population of " + population );
         
    } 
    
    public int populationIn10()
    {
        double populationAmount = population;
        int count = 10;
        while ((count > 0) && (populationAmount > 0))
        {
            populationAmount = (populationAmount +
                              (growthRate/100) * populationAmount);
            count--;
       }
       if (populationAmount > 0)
            return (int)populationAmount;
        else
            return 0;
    }
    
    public static void main( String[] args ) {
      
      SpeciesFirstTry_1 spf = new SpeciesFirstTry_1( "Klingon Ox", 1000, .10 );
      
      spf.writeOutput();
      
      spf.showLandPortion();
    }
      
}