Source of SpeciesThirdTryDemo.java


  1: //SpeciesThirdTryDemo.java
  2: 
  3: /**
  4:  * Demonstrates a classhaving private instance variables.
  5:  */
  6: public class SpeciesThirdTryDemo
  7: {
  8:     public static void main(String[] args)
  9:     {
 10:         SpeciesThirdTry speciesOfTheMonth = new SpeciesThirdTry();
 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:         //speciesOfTheMonth.name = "Klingon ox"; //ILLEGAL
 20:         //speciesOfTheMonth.population = 10;     //ILLEGAL
 21:         //speciesOfTheMonth.growthRate = 15;     //ILLEGAL
 22:         System.out.println("The new Species of the Month:");
 23:         speciesOfTheMonth.writeOutput();
 24:         System.out.println("In ten years the population will be "
 25:             + speciesOfTheMonth.predictPopulation(10));
 26:     }
 27: }