// Filename RoomFillerNT.java. // non-thread version // import Counters.RoomMonitor; import java.util.Random; public class RoomFillerNT { RoomMonitor roomToFill; Random generator = new Random(); public RoomFillerNT( RoomMonitor theMonitor ) { roomToFill = theMonitor; } // End RoomFiller onstructor; public void start() { int delay; int count = 0; while ( count < 10 ) { /*** the sleep() is available only to thread try { delay = (int) (generator.nextDouble() * 200.0); this.sleep( delay); } catch ( InterruptedException exception ){ // Do nothing. } ***/ roomToFill.enterRoom(); count ++; System.out.println( "Entered ..."); } } }