rendered paste body//Zachary Fitzsimmons
import java.util.*;
import java.io.*;
public class testMovie
{
public static void main(String[] args) throws IOException //y'all
{
Scanner scan = new Scanner(new File("movies.txt"));
ArrayList<Movie> movies = new ArrayList<Movie>();
Integer year;
String temp, title;
String[] names;
LinkedList<Person> actors;
Person director;
while(scan.hasNext())
{
temp = scan.nextLine();
year = Integer.valueOf(temp.substring(0, 4));
title = temp.substring(5, 36);
names = temp.substring(38, 84).split(", ");
actors = new LinkedList<Person>();
for(String actor : names) //read the names into the actors
actors.add(new Person(actor.substring(0, actor.indexOf(" ")),
actor.substring(actor.indexOf(" ") + 1)));
names = temp.substring(89).split(" "); //better than tokenizer
director = new Person(names[0], names[1]); //make the director
movies.add(new Movie(year, title, director, actors));
}
Collections.sort(movies);
Integer numActors = 0;
for(Movie temp_movie : movies)
{
System.out.println(temp_movie);
for(Person actor : temp_movie.getActors())
numActors++;
}
System.out.println(numActors + " actors total");
}
}