Modify the Student class to compute the graduation year. Assume all students (in a perfect world) graduate in 4 years. Define a method named getGraduationYear() which returns the graduation year defined as 4 + the year of enrollment.
Student Class:
public class Student
{
// Declaration of instance variables
private String name;
private String major;
private int yearEnrolled;
// Constructor
public Student(String n, int y) {
name = n;
major = “undeclared”;
yearEnrolled = y;
}
public void setMajor(String m) { major = m; }
public String getMajor() { return major; }
public int getYear() { return yearEnrolled; }
public String getName() { return name; }
}
Define getGraduationYear().