@Override
    protected Integer doInBackground() throws Exception { //To change body of generated methods, choose Tools | Templates.
        
        if (operation.equals("fc") || operation.equals("it")) {
            
            String innerGrade = grade;
            int rowCount= ((DefaultTableModel)table.getModel()).getRowCount();
            double overallPaid =0, overallCost =0, overallBal =0, overallTerm=0;
            if (operation.equals("it")) {
                updateTerm(grade, term);
                }
            for (int index=0;index<rowCount;index++) {
                System.out.println(index);
                if (grade.equals("All")) {
                    innerGrade = ((DefaultTableModel)table.getModel()).getValueAt(index, 6).toString();
                }
                String student = ((DefaultTableModel)table.getModel()).getValueAt(index, 0).toString();
                
                if (operation.equals("it")) {
                    addPayment(student, ((double)getCost(grade)/3.00), "Tuition: " +term);
                }
                
                double cost = getTotalDue(student); 
                overallCost+=cost;
                double totalCost = cost;
                overallTerm+=totalCost;
                
                Object[] data = {totalCost, index, 3};
                publish(data);
                
                double totalPaid=getPaid(student);
                if (totalPaid!=0){
                    totalPaid = -1 * totalPaid;
                }
                overallPaid+=totalPaid;
                Object[] data1 = {totalPaid, index, 4};
                publish(data1);
                
                double diff = totalCost - totalPaid;
                overallBal+=diff;
                Object[] data2 = {diff, index, 5};
                publish(data2);
                
            }
            Object[] row = {rowCount+" Students", "-","-",overallTerm, overallPaid, overallBal};
            this.row=row;
        }
        
        return 0;
    }