Source of SpeciesFirstTryDemo.java


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