//******************************************************************** // Philosopher.java Author: Lewis and Loftus // // Demonstrates the implementation of an interface. //******************************************************************** class Philosopher implements Speaker { private String philosophy; //----------------------------------------------------------------- // Establishes this philosopher's philosophy. //----------------------------------------------------------------- public Philosopher (String philosophy) { this.philosophy = philosophy; } //----------------------------------------------------------------- // Prints this philosophers's philosophy. //----------------------------------------------------------------- public void speak () { System.out.println (philosophy); } //----------------------------------------------------------------- // Prints the specified announcement. //----------------------------------------------------------------- public void announce (String announcement) { System.out.println (announcement); } //----------------------------------------------------------------- // Prints this philosophers's philosophy multiple times. //----------------------------------------------------------------- public void pontificate () { for (int count=1; count <= 5; count++) System.out.println (philosophy); } }