/* Small program to test the theatre class. * * Carsten Butz, October 2002. */ class TestTheatre{ public static void main(String[] Args){ /* create a Theatre */ Theatre t = new Theatre(4,3); /* Show the empty theatre */ System.out.println("Empty theatre"); t.showReservations(); /* Make two reservations */ System.out.println("Reservations:"); System.out.println("1,3"); t.reserve(1,3); System.out.println("1,1"); t.reserve(1,1); /* Find the next free seat */ t.findSeat(); /* Book a seat */ System.out.println("Reservations:"); System.out.println("1,2"); t.reserve(1,2); /* Find again the next free seat */ t.findSeat(); /* Show the theatre */ t.showReservations(); /* Release a seat that had been booked */ System.out.println("Release seat row 1 seat 2"); t.cancel(1,2); /* Show the number of total reservations and the theatre */ System.out.println("Number of reservations: " + t.numReservations()); t.showReservations(); } }