private String formatClass(String str)
    {
        String class_abbrv = "";
        String class_num = "";
        String class_section = "";
        String formattedString = "";
        
        int firstSub = 0;
        int secondSub = 0;
        int thirdSub = 0;
        int fourthSub = 0;
        int fifthSub = 0;
        int sixthSub = 0;
        
        
        if(str.length() < 10) //2 letter class abbrv
        {
            firstSub = 0;
            secondSub = 2;
            thirdSub = 2;
            fourthSub = 5;
            fifthSub = 5;
            sixthSub = 9;
            
        }
        else if(str.length() < 11) //3 letter class abbrv
        {
            firstSub = 0;
            secondSub = 3;
            thirdSub = 3;
            fourthSub = 6;
            fifthSub = 6;
            sixthSub = 10;
            
        }
        else if(str.length() < 12) //4 letter class abbrv
        {
            firstSub = 0;
            secondSub = 4;
            thirdSub = 4;
            fourthSub = 7;
            fifthSub = 7;
            sixthSub = 11;
            
        }
        else if(str.length() < 13) //5 letter class abbrv
        {
            firstSub = 0;
            secondSub = 5;
            thirdSub = 5;
            fourthSub = 8;
            fifthSub = 8;
            sixthSub = 12;
            
        }
        
            class_abbrv = str.substring(firstSub, secondSub); //class_abbrv = "CS"
            formattedString = class_abbrv + "-"; //formattedString = "CS-"
            class_num = str.substring(thirdSub, fourthSub);
            formattedString = formattedString + class_num + "-";
            class_section = str.substring(fifthSub, sixthSub);
            formattedString = formattedString + class_section;
        
        return formattedString;
    }