Source of SpeciesSecondTryDemo.java


  1: 
  2: /**
  3:  Demonstrates the use of a parameter
  4:  with the method projectedPopulation.
  5: */
  6: public class SpeciesSecondTryDemo
  7: {
  8:     public static void main(String[] args)
  9:     {
 10:         SpeciesSecondTry speciesOfTheMonth = new SpeciesSecondTry( );
 11:        
 12:         System.out.println("Enter data on the Species of the Month:");
 13:         speciesOfTheMonth.readInput( );
 14:         speciesOfTheMonth.writeOutput( ); 
 15:         int futurePopulation = speciesOfTheMonth.predictPopulation(10);
 16:         System.out.println("In ten years the population will be " +
 17:                             futurePopulation);
 18:         
 19:         //Change the species to show how to change 
 20:         //the values of instance variables:
 21:                 speciesOfTheMonth.name = "Klingon ox";
 22:         speciesOfTheMonth.population = 10;
 23:         speciesOfTheMonth.growthRate = 15;
 24:         System.out.println("The new Species of the Month:");
 25:         speciesOfTheMonth.writeOutput( ); 
 26:         System.out.println("In ten years the population will be " + 
 27:                             speciesOfTheMonth.predictPopulation(10));
 28:     }
 29: }