// purpose: test out Movie and Theater classes import java.util.*; public class MTDemo { public static void main( String[] args ) { String m1 = "Enchanted"; String m2 = "Hanna Montana in 3D"; String m3 = "Horton hears a who"; String t1 = "Carmike"; String t2 = "Downtown"; String t3 = "Odeon"; Movie movie1 = new Movie( m1 ); Movie movie2 = new Movie( m2 ); Movie movie3 = new Movie( m3 ); Theater theater1 = new Theater( t1 ); Theater theater2 = new Theater( t2 ); Theater theater3 = new Theater( t3 ); System.out.println( "Movies and theaters before adding entries to their lists" ); System.out.println( "========================================================" ); System.out.println( "movie1: " + movie1 ); System.out.println( "movie2: " + movie2 ); System.out.println( "movie3: " + movie3 ); System.out.println(); System.out.println( "theater1: " + theater1 ); System.out.println( "theater2: " + theater2 ); System.out.println( "theater3: " + theater3 ); System.out.println(); System.out.println( "Testing adding theaters 1-3, and 2 to movie1" ); System.out.println( "============================================" ); movie1.addTheater( theater1 ); movie1.addTheater( theater2 ); movie1.addTheater( theater3 ); movie1.addTheater( theater2 ); System.out.println( "movie1: " + movie1 ); System.out.println(); System.out.println( "Adding theaters 1-3, and 2 to movie1, should also affect the theaters" ); System.out.println( "=====================================================================" ); System.out.println(); System.out.println( "theater1: " + theater1 ); System.out.println( "theater2: " + theater2 ); System.out.println( "theater3: " + theater3 ); System.out.println(); System.out.println( "Testing removing theaters 1, 2, 3, and 2 from movie1" ); System.out.println( "====================================================" ); movie1.removeTheater( theater1 ); System.out.println( "movie1: " + movie1 + " **** theater1 should begone " ); movie1.removeTheater( theater2 ); System.out.println( "movie1: " + movie1 + " **** theater2 should also be gone" ); movie1.removeTheater( theater3 ); System.out.println( "movie1: " + movie1 + " **** all movies should be gone" ); movie1.removeTheater( theater2 ); System.out.println( "movie1: " + movie1 + " **** attempted theater2 a second time " ); System.out.println(); System.out.println( "Removing theaters 1-3, and 2 from movie1, should also affect the theaters" ); System.out.println( "=========================================================================" ); System.out.println( "theater1: " + theater1 + " **** expecting no movies" ); System.out.println( "theater2: " + theater2 + " **** expecting no movies" ); System.out.println( "theater3: " + theater3 + " **** expecting no movies" ); } }