Source of SpeciesFourthTryDemo.java


  1: 
  2: import java.util.*;
  3: 
  4: /**
  5:  Demonstrates the use of the mutator method set.
  6: */
  7: public class SpeciesFourthTryDemo
  8: {
  9:     public static void main(String[] args)
 10:     {
 11:         SpeciesFourthTry speciesOfTheMonth =
 12:                                          new SpeciesFourthTry( );
 13:         int numberOfYears, futurePopulation;
 14: 
 15:         System.out.println("Enter number of years to project:");
 16:         Scanner keyboard = new Scanner(System.in);
 17:         numberOfYears = keyboard.nextInt( );
 18: 
 19:         System.out.println(
 20:                        "Enter data on the Species of the Month:");
 21:         speciesOfTheMonth.readInput( );
 22:         speciesOfTheMonth.writeOutput( );
 23:         futurePopulation =
 24:              speciesOfTheMonth.projectedPopulation(numberOfYears);
 25:         System.out.println("In " + numberOfYears
 26:                                 + " years the population will be "
 27:                                 + futurePopulation);
 28:         speciesOfTheMonth.set("Klingon ox", 10, 15);
 29:         System.out.println("The new Species of the Month:");
 30:         speciesOfTheMonth.writeOutput( );
 31:         System.out.println("In " + numberOfYears
 32:            + " years the population will be "
 33:            + speciesOfTheMonth.projectedPopulation(numberOfYears));
 34:     }
 35: }
 36: 
 37: 
 38: