/* TestCinema.java Version history: - 2002-09-10 - minor update: spelling errors, code comments -- Philip Heede - 2002-10-31 - initial release -- Philip Heede - - - - The main() method tests the Cinema class. Prints relevant information demonstrating the effect of the different methods. */ public class TestCinema { public static void main(String[] args) { System.out.println("Creating Imperial movie theater with 6 seats on row 0,"); System.out.println("5 seats on row 1, 4 seats on row 2 and 3 seats on rows 3 and 4."); System.out.println("This gives a total of 21 available seats on 5 rows."); System.out.println(); // instantiating new Cinema object Cinema imperial = new Cinema(new int[]{6,5,4,3,3}); // printing basic statistics for the Cinema object System.out.println("The Imperial movie theater:"); System.out.println(imperial); System.out.println(); System.out.println("There are " + imperial.rows() + " rows in this theater."); System.out.println("There are " + imperial.seats() + " total seats in this theater."); System.out.println("There are " + imperial.vacancies() + " vacant seats at this time."); System.out.println("There are " + imperial.seatsOnRow(0) + " seats on row 0."); System.out.println("There are " + imperial.rowVacancies(0) + " vacant seats on row 0."); // demonstrating book() method in the Cinema object System.out.println("Booking seat 3 on row 0:"); imperial.book(0, 3); System.out.println(imperial); System.out.println("There are " + imperial.vacancies() + " vacant seats at this time."); System.out.println("There are " + imperial.rowVacancies(0) + " vacant seats on row 0."); System.out.println(); // demonstrating book() and release() methods of the Cinema object System.out.println("Releasing seat 3 on row 0 and booking seat 3 on row 2 instead:"); imperial.release(0, 3); imperial.book(2, 3); System.out.println(imperial); System.out.println("There are " + imperial.vacancies() + " vacant seats at this time."); System.out.println("There are " + imperial.rowVacancies(0) + " vacant seats on row 0."); System.out.println(); } }