I'm supposed to complete computeStudentMean method and the displayMeans method. Method computeStudentMean accesses the four grades in each individual student record, computes the mean of the four grades and stores the result in mean. Method displayMeans list all the student name and their respective test averages.
My problem is that I keep on getting an error that says I have a ClassCastException
Code:
import java.io.*;
import java.util.ArrayList;
public class lab20
{
public static void main(String args[]) throws IOException
{
System.out.println("Lab 20 80/100 POINT VERSION");
ClassList list = new ClassList();
list.getList();
list.pause();
list.computeStudentMean();
// list.computeTestMean();
// list.computeClassMean();
list.displayMeans();
System.out.println();
}
}
public Student(String n, int g1, int g2, int g3, int g4)
{
name = n;
grades = new ArrayList();
grades.add(new Integer(g1));
grades.add(new Integer(g2));
grades.add(new Integer(g3));
grades.add(new Integer(g4));
}
}
private ArrayList students;
private int studentCount;
private ArrayList testMean;
private int testCount;
private double classMean;
public ClassList()
{
students = new ArrayList();
testMean = new ArrayList();
studentCount = 0;
testCount = 4;
}