by the way here is my
test class just in case i made a mistake there and the sorting is not working because of this:
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
class Driver
{
public static void main(
String arg[])
{
Filing f = new Filing();
int m;
do
{
m = getData.getInt("Choose from the follwing menu:\n1- add a Student without GPA. \n2- add a Student with GPA. \n3- change a Student's current GPA\n4-Print\n5-Exit");
switch(m)
{
case 1:
String id = getData.getString("enter student's id");
String lName = getData.getString("enter student's last name");
String fName = getData.getString("enter student's first name");
Student s = new Student(id,lName,fName);
Undergraduate u = new Undergraduate(s);
f.addToList(s);
break;
case 2:
String Id = getData.getString("enter student's id");
String LName = getData.getString("enter student's last name");
String FName = getData.getString("enter student's first name");
double gPA = getData.getDouble("enter the student's GPA");
Student t = new Student(Id,LName,FName,gPA);
Undergraduate n = new Undergraduate(t);
f.addToList(t);
break;
case 3:
String tempID = getData.getString("enter student's id");
double NewGPA = getData.getDouble("enter the student's GPA");
if(f.search(tempID) == true)
break;
case 4:
f.Sort();
JTextArea text = new JTextArea(f.toString(),15,40);
JScrollPane scroll = new JScrollPane(text);
JOptionPane.showMessageDialog(null, scroll,"Student Information", JOptionPane.INFORMATION_MESSAGE);
break;
case 5:
break;
default:
break;
}
}
while(m!=5);
}
}