public static HashMap<String, Integer> countDefects(Scanner ifile1)
    {
        /* instantiate HashMap */
        HashMap<String, Integer> defectMap = new HashMap<String, Integer>();

        /* initialize variables */
        int fieldCount = 0;
        int yearCount = 0;
        int yearFieldNumber = 4;
        String fieldText = "";
        String yearString = "";

        //String year = "";
        int defectCount = 0;

        /* read ifile1 field by field */
        while(ifile1.hasNext())
        {
            while(fieldCount < yearFieldNumber)
            {
                fieldCount++;
                fieldText = ifile1.next();

                /* if field4 (model year) equals defectYear, add 1 to yearCount */
                if(fieldCount == yearFieldNumber)
                {
                    yearString = fieldText;
                    
                    if(defectMap.containsKey(yearString))
                    {
                        defectMap.put(yearString, (defectMap.get(yearString) + 1));
                    }
                    
                    else  //if defectMap doesn't contain key of "yearString"
                    {
                        defectMap.put(yearString,  1);
                    }
                        
                }//end of IF(fieldCount = yearFieldNumber)

            }//end of WHILE(fieldCount < yearFieldNumber)
                
            ifile1.nextLine();  //advance cursor to next line to reduce i/o
            fieldCount = 0;  //reset field counter when we advance to next record

        }//end of WHILE(ifile1.hasNext())

        /* close input file */
        ifile1.close();
        return defectMap;
        
    }//end of method countDefects()