// purpose: represents a movie with regard to its availability import java.util.*; public class Movie { // attributes private String name; private ArrayList theaterList; // specific constructor public Movie( String s ) { name = s; this.theaterList = new ArrayList(); } // isAt(): is theater t playing the movie *************************** public boolean isAt( Theater t ) { // Return whether the list of theaters contains t return false; } // mutators // addTheater(): adds t to the theater list if is not there ************ public void addTheater( Theater t ) { // If theater t is not already on the theater list of this movie, // then directly add theater t to the theater list of this movie. // If this movie is not on the playing list of theater t, then add // this movie to the movie list of t. } // removeTheater(): removes t from the theater list if is there ******** public void removeTheater( Theater t ) { // If theater t is on the theater list of this movie, then // directly remove theater t from the theater list of this movie. // If this movie is on the playing list of theater t, then remove // this movie from the movie list of t. } // setName(): sets the name to s public void setName( String s ) { this.name = s; } // inspectors // getName(): return the the name of the movie public String getName() { return this.name; } // getNumberOfTheaters(): indicates number of theaters playing the movie public int getNumberOfTheaters() { return this.theaterList.size(); } // getTheaters(): returns the theaters playing the movie public ArrayList getTheaters() { return this.theaterList; } // toString(): return a textual representation of the movie public String toString() { String name = this.getName(); int n = theaterList.size(); String list = ""; for ( int i = 0; i < n; ++i ) { Theater t = theaterList.get( i ); list = list + " " + t.getName(); } String result = "Movie( " + name + "[ " + list + "] )"; return result; } }