Link to code: ClassScores.java

import java.io.FileNotFoundException;
import java.io.File;
import java.util.*; // for Scanner and ArrayList
import javax.swing.JFileChooser;


public class ClassScores {
    // chooser allows users to select a file by navigating through
    // directories
    private static JFileChooser ourChooser = new JFileChooser(System
            .getProperties().getProperty("user.dir"));

    /**
     * Brings up chooser for user to select a file
     * @return Scanner for user selected file, null if file not found
     */
    public  Scanner getScanner(){
        
        int retval = ourChooser.showOpenDialog(null);
        
        if (retval == JFileChooser.APPROVE_OPTION){
            File f = ourChooser.getSelectedFile();	
            Scanner s;
            try {
                s = new Scanner(f);
            } catch (FileNotFoundException e) {
                return null;
            }
            return s;
	    }
        return null;
    }

    /**
     * Reads in all of the words in a file and prints each one out
     * one per line to the console.
     * @param in initialized Scanner for file
     */
    public void readAndPrintFile(Scanner in) {
        // TODO: complete readAndPrintFile
    }

    /**
     * Returns the "mode" of a set of data points: the most common
     * value(s)
     * @param scores scores on each test papers in range [0,100]
     * @return mode of the set of scores. In the case of more than
     * one number, they should be returned in increasing order. 
     */
    public int[] findMode(int[] scores) {
        // TODO: complete findMode for an array

        // FIX: returning empty array
        return new int[0];
    }

    /**
     * Returns the "mode" of a set of data points: the most common
     * value(s)
     * @param in legal (i.e., non-null) input where each token is a
     * integer
     * @return mode of the set of scores. In the case of more than
     * one number, they should be returned in increasing order. 
     */
    public int[] findMode(Scanner in) {
        // TODO: complete findMode for a file

        // FIX: returning empty array
        return new int[0];
    }


    public static void main(String[] args) {
        double[] example = { 88, 70, 65, 70, 88};

        // TODO: construct ClassScores object

        // TODO: Call getScanner to choose and open file for reading

        // TODO: Call readAndPrintFile to print contents
        
        // TODO: test out mode implementations
        
    }
}