// In our college of education, they pretty much don't give out grades of C, so we refine the GradStudent so that only As and Bs are given out public final class EducationGradStudent extends GradStudent { // no new instance data // use the same constructors as GradStudent public EducationGradStudent() { super(); undergradMajor="Education"; } public EducationGradStudent(String f, String l) { super(f, l, "Education"); } public EducationGradStudent(String f, String l, String m) { super(f, l, m, "Education"); } public EducationGradStudent(String f, String l, String m1, String m2) { super(f, l, "Education"); undergradMajor=m1; } public EducationGradStudent(String f, String l, String m, double g, int h) { super(f, l, "Education", g, h); undergradMajor=m; } public EducationGradStudent(String f, String l, String m1, String m2, double g, int h) { super(f, l, "Education", g, h); undergradMajor=m1; } @Override public boolean equals(Student s) // if s is not an EducationGradStudent, return false, otherwise test s to this using super's equal { if(!(s instanceof EducationGradStudent)) return false; else return super.equals(s); } @Override public void newClass(char grade, int hours) { switch(grade) { case 'A': gpa=(gpa*hoursEarned+hours*4)/(hoursEarned+hours); hoursEarned+=hours; break; case 'B': gpa=(gpa*hoursEarned+hours*3)/(hoursEarned+hours); hoursEarned+=hours; break; case 'F': gpa=(gpa*hoursEarned+hours*0)/(hoursEarned+hours); hoursEarned+=hours; break; default: System.out.println("Error, " + grade + " is not a legal grade"); } } }