// Filename Counters/RoomMonitorDemonstration.java. // Demonstration client for the RoomMonitor class. // // Written for JFL book Chapter 5 see text. // Fintan Culwin, v0.1, January 1997 import Counters.RoomMonitor; public class RoomMonitorDemonstration { public static void main( String argv[]) { RoomMonitor demoMonitor = new RoomMonitor(25); System.out.println( "\n\t\t Room Monitor demonstration \n"); System.out.println( "The monitor has been created ..."); System.out.println( "\n Four people enter the room ... "); demoMonitor.enterRoom(); demoMonitor.enterRoom(); demoMonitor.enterRoom(); demoMonitor.enterRoom(); System.out.println( "\n Two people leave the room ... "); demoMonitor.exitRoom(); demoMonitor.exitRoom(); System.out.println( "\n One person enters the room ... "); demoMonitor.enterRoom(); System.out.print( "The value of numberCurrentlyInRoomIs() should be 3 .."); System.out.print( demoMonitor.numberCurrentlyInRoomIs()); System.out.println( "." ); System.out.print( "The value of maxEverInRoomIs() should be 4 ... "); System.out.print( demoMonitor.maxEverInRoomIs()); System.out.println( "." ); System.out.print( "The value of totalNumberEnteredIs() should be 5 ... "); System.out.print( demoMonitor.totalNumberEnteredIs()); System.out.println( "." ); System.out.println( "\n Demonstrating the toString action ..."); System.out.println( demoMonitor); System.out.println(" integer.MAX_VALUE " + Integer.MAX_VALUE); } // End main } // End RoomMonitorDemonstration