MovieParser

MovieParser - Parse all lines from the [email protected] fr...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; import java.util.Scanner; /* Parse the movie database. * * The format of this database is one movie per line, with movie fields * separated by a ",". The format is: * * title,category * * Note that there is no space before or after the ",". */ public class MovieParser { private Movie[] m_movies; /* The main function. * * It should be provided exactly one argument -- the filename of the * database to open and parse. */ public static void main(String[] argv) throws FileNotFoundException, ParseError { FileReader fr = new FileReader("IMDBTop10.txt"); MovieParser mp = new MovieParser(fr); Movie[] movies; movies = mp.getMovies(); // Do something with 'movies' here
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } /* Parse all lines from the database. * * @param fr The FileReader object from which to read the database. */ public MovieParser(FileReader fr) throws ParseError { } /* Return a copy of the array of movies */ public Movie getMovies() { } /* Parse all lines from the database. * * @param scn The Scanner object from which to read the database. */ private void parseAll(Scanner scn) throws ParseError { } /* Parse one line from the database. * * @param line One line from the movie database, without the newline * character. */ private Movie parseOne(String line) throws ParseError { } }...
View Full Document

This note was uploaded on 11/11/2011 for the course CS 2110 taught by Professor Francis during the Spring '07 term at Cornell.

Page1 / 2

MovieParser - Parse all lines from the [email protected] fr...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online