import java.io.*;
import java.util.*;

/**
 * An example that illustrates the use of reading from a file
 * and using the Scanner class.
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class FacultyRecordScanner
{
    /**
     * The entry point of the application
     *
     * @param args   The command-line arguments
     */
    public static void main(String[] args)
    {
	Scanner in;
	String  delimiters, email, line, name, phone;


        try
        {
            // Setup the reader and writer
            in = new Scanner(new File("cs.txt"));
            in.useDelimiter("\t");
            
            // Keep reading and processing until EOF
            while (in.hasNext())
            {
                name = in.next();
                phone = in.next();
                email = in.nextLine(); // Also consume the end-of-line character
                email = email.substring(1); // Strip-off the leading delimiter
                            
                // Do something with the information

            }
            in.close();
        }
        catch (IOException ioeFile)
        {
            System.err.println("Unable to open the file.");
        }
    }
}
