import java.util.*; /** * Write a description of class Driver here. * * @author Jerediah Fevold * @version 7 March 2007 */ public class Driver { // instance variables - replace the example below with your own String actor = ""; /** * Constructor for objects of class Driver */ public Driver() { LinkedListFromFile movieList = new LinkedListFromFile("movies.txt"); LinkedListFromFile actorList = new LinkedListFromFile("actors.txt"); String actor, movie; ListIterator iter1, iter2; iter1 = actorList.listIterator(); EasyWriter outFile = new EasyWriter("actor_movie.txt"); if (outFile.bad()) { System.err.println("Can't create actor_movie.txt\n"); System.exit(1); } while (iter1.hasNext()) { actor = (String)iter1.next(); if (!iter1.hasNext()) break; System.out.println(actor + ": "); outFile.println(actor + ": "); iter2 = movieList.listIterator(movieList.size()); while (iter2.hasPrevious()) { movie = (String)iter2.previous(); if(movie.indexOf(actor) != -1) { System.out.println("\t" + movie.substring(movie.indexOf(" "), movie.indexOf(" "))); outFile.print("\t" + movie.substring(movie.indexOf(" "), movie.indexOf(" "))); } } } } }