/** * Student class to represent an actual student. */ public class Student { //instance variables private String name; private int idNum; private double gpa; private Course course1; private Course course2; //Constructors public Student(String inName, int inID, double inGPA) { name = inName; idNum = inID; gpa = inGPA; } //get methods public String getName() { return name; } public int getID() { return idNum; } public double getGPA() { return gpa; } //method for changing name public void changeName(String newName) { name = newName; } //method for changing gpa public void updateGPA(double newGPA) { gpa = newGPA; } public void addCourse1(Course c) { course1 = c; course1.incrementNumStudents(); } public void addCourse2(Course c) { course2 = c; c.incrementNumStudents(); //Can call it on c or course2 as they are both pointing to the same object } public void printSchedule() { System.out.println(name + "'s first course is " + course1.getName()); System.out.println(name + "'s second course is " + course2.getName()); System.out.println(); } }