All pastes #283725 Raw Edit

Movie

public text v1 · immutable
#283725 ·published 2006-12-18 15:46 UTC
rendered paste body
//Zachary Fitzsimmons
import java.util.*;
import java.io.*;
public class Movie
  implements Comparable<Movie>
{
  private Integer year;
  private String title;
  private Person director;
  private LinkedList<Person> actors;
  
  public Movie()
  {
    year = 0;
    title = "";
    director = new Person();
    actors = new LinkedList<Person>();
  }
  public Movie(int y, String t, Person d, LinkedList<Person> a)
  {
    year = y;
    title = t;
    director = d;
    actors = new LinkedList<Person>();
    for(Person p : a)
      actors.add(p);
  }
  public LinkedList<Person> getActors()
  {
    return actors;
  }
  public int compareTo(Movie m2)
  {
    return title.compareTo(m2.title);
  } 
  public String toString()
  {
    String actor_string = "";
    
    for(Person actor : actors)
      actor_string += actor + " ";
      
    return new String(year + " " + title + " Director: " + director + " Actors: " + actor_string);
  }
}