class Roster
{
    public static int MAXSTUDENTS = 5;
    public static int numStudents = 0;
    //helper method to get a student's name
    
    public static void main(String [] args) {
	
	Student theroster[] = new Student[MAXSTUDENTS]; 
	
	//get students (in order) from input arguments
	for(int i=0; i < MAXSTUDENTS && i<args.length; i+=2, numStudents++) {
	    if(args[i] == "u")
		theroster[numStudents] = new UndergraduateStudent("student " + args[i+1]);
	    else
		theroster[numStudents] = new GraduateStudent("student " + args[i+1]);
	}

	//compute course grades 
	for (int i=0; i<numStudents; i++)  {
	    theroster[i].computeCourseGrade(); //this is polymorphism (why?)
	}
	
	//print course grades
	for (int i=0; i<numStudents; i++)  {
	    System.out.println(theroster[i].getName() + "  has grade: " //this is not polymorphism
			       + theroster[i].getCourseGrade());
	}
    } 
}
