public class SpeciesThirdTryDemo
1:
2: /**
3: Demonstrates a classhaving private instance variables.
4: */
5: public class SpeciesThirdTryDemo
6: {
7: public static void main(String[] args)
8: {
9: SpeciesThirdTry speciesOfTheMonth = new SpeciesThirdTry( );
10:
11: System.out.println("Enter data on the Species of the Month:");
12: speciesOfTheMonth.readInput( );
13: speciesOfTheMonth.writeOutput( );
14: int futurePopulation = speciesOfTheMonth.predictPopulation(10);
15: System.out.println("In ten years the population will be " +
16: futurePopulation);
17:
18: // speciesOfTheMonth.name = "Klingon ox"; //ILLEGAL
19: // speciesOfTheMonth.population = 10; //ILLEGAL
20: // speciesOfTheMonth.growthRate = 15; //ILLEGAL
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.predictPopulation(10));
25: }
26: }