?
2009-12-07 19:52:08 UTC
The very last line (noted) is giving me a syntax error and I'm pretty sure it's just that my logic is off but I can't figure it out. The error says "Type mismatch: cannot convert from double to Student".
This is my sorting method so far:
public static Student[] sortStudents(Student[] std){
//You need to write code for sorting the student array
for (int i = std.length - 1; i >= 1; i--)
{
double currentMax = std[0].getMidScore();
int currentMaxIndex = 0;
for (int j = 1; j <= i; j++)
{
if (currentMax < std[j].getMidScore())
{
currentMax = std[j].getMidScore();
currentMaxIndex = j;
}
}
if (currentMaxIndex != i)
{
std[currentMaxIndex] = std[i];
std[i] = currentMax; // This line is giving me the error
}
}