import java.util.Scanner;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * Driver class for CSS 162 Homework 1
 * 
 * @author Clark Olson
 */
public class HW1
{

/**
 * Main: Displays an inventory of the letters in a test file
 * pre:  none
 * post: outputs a table with the number of occurrences of each letter in the file, if it exists
 *       outputs an error message, if the file does not exist
 */
    public static void main (String[] args) {
        Scanner charFile = null;              

        // open the file 
        try {
            charFile = new Scanner(new FileInputStream("test.txt"));
        }
        catch (FileNotFoundException e) {
            System.out.println("File not found or not opened.");
            System.exit(0);
        }
        
        // inventory and display the letters
        Inventory charInventory = new Inventory();
        charInventory.countOccurrences(charFile);
        charInventory.displayTable();
        charInventory.resetInventory();
    }  
}
