public class Student {
	public String name;
	public int id;
	public Course [] courses;
	public int numCourses;

	public Student(String name, int id) {
		this.name = name;
		this.id = id;
		courses = new Course[5];
		numCourses = 0;
	}

	public double calcGPA() {
		int totalUnits = 0;
		double totalGPAPoints = 0.0;
		for (int i=0;i<numCourses;i++) {
			totalUnits = totalUnits + courses[i].units;
			totalGPAPoints = totalGPAPoints + (courses[i].units * courses[i].grade);
		}
		if (totalUnits != 0) {
			return totalGPAPoints/totalUnits;
		} else {
			return 0.0;
		}
	}

	public void addCourse(Course c1) {
		if (numCourses < 5) {
			courses[numCourses++] = c1;
		}
	}
}