All pastes #461933 Raw Edit

Someone

public java v1 · immutable
#461933 ·published 2007-04-27 22:56 UTC
rendered paste body
	public OutputData enrollStudentInCourse(SemesterPair semesterPair, String courseName, String uid)	{	OutputData error = new OutputData();	int courseIndex = findCourseWithInfo(semesterPair, courseName);	int studentIndex = findStudentWithUID(uid);	if(courseIndex == -1) // course is NOT found	    error.append("That course does not exist in database!");		if(studentIndex == -1) // student uid NOT exists	    error.append("That student does not exist in database!");		if (courseIndex != -1)	{		if(!(courseArray[courseIndex].getCurrentEnrollment() < courseArray[courseIndex].getMaxEnrollment())) // there is no room		    error.append("That course is full!");	}		if (studentIndex != -1 && courseIndex != -1)	{		if(courseArray[courseIndex].findStudent(uid)) // student found in course		    error.append("That student is already enrolled in that course!");	}		if (!error.isEmpty())		return error;		    // add course to student transcript	studentArray[studentIndex].addCourse(semesterPair, courseName, courseArray[courseIndex].getCredit());		    	// add uid to course roster	courseArray[courseIndex].addStudent(uid);			return error;	}