//I can make an interface and a javabean with getters and setters, but with the code below not able to get movie out to console after entering director name.
import java.io.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.io.IOException;
import java.sql.Connection;
import java.util.Enumeration;
public class ChosenDirector {
//Create a buffered reader to read
//each line from the keyboard.
static ArrayList<
String> chosendirector=new ArrayList<String>();
public static void main(String args[]) throws IOException {
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(ir);
String director=" "; // Note: here we are assuming Director could
String movie= " "; // or will be different for each user.
String FILE_NAME = "Directormovies.txt";
String s;
//////////////////////////////////////////////////////////
// read the DIRECTOR information from the console, and
//when director name is entered his movie should come from FILE_NAME Wild at Heart, The Muppets, Jurassic Park, Batman, and RockyVI
//////////////////////////////////////////////////////////
System.out.println ("Enter Director name to get Movie : David Lynch, Jim Henson, Stephen Spielberg, Tim Burton or, Aki Kaurismaki");
//StringBuffer stdin = StringBuffer;{
System.out.print("NAME OF DIRECTOR: \n" );
s = in.readLine();
try {
} catch (SecurityException se) {
// read the Director and Movie information from the file
//System.out.println("About to read Director info from file "
// + FILE_NAME);
File srcFile = new File(FILE_NAME);
//print out the Director name and his movie
File c = srcFile;
for(String c1: chosendirector)
{
String[] temp = c1.split(":");
//now we should have temp[0] = "director" and temp[1] = "movie"
chosendirector.add(c1);
}
while (director.split(movie)!=null) {
String[] tokens = director.split("[:]+");
System.out.println("Name of Director is: "+ director + "and movie is:"+ movie);
}
}
}
}