public class eg35_CompSciStudent extends eg35_Student { //required hours private final int MATH_HOURS = 20; private final int CS_HOURS = 40; private final int GEN_ED_HOURS = 60; //hours taken private int mathHours; private int csHours; private int genEdHours; //constructor public eg35_CompSciStudent(String n, String id, int year) { //need to call superclass constructor, superclass has no default constructor or non-arg constructor super(n, id, year); } public void setMathHours(int math) { mathHours = math; } public void setCsHours(int cs) { csHours = cs; } public void setGenEdHours(int genEd) { genEdHours = genEd; } //MUST override abstract method in superclass public int getRemainingHours() { int regHours, remainingHours; regHours = MATH_HOURS + CS_HOURS + GEN_ED_HOURS; remainingHours = regHours - (mathHours + csHours + genEdHours); return remainingHours; } public String toString() { String str; str = super.toString() + "\nMajor: Computer Science"+ "\nMath Hours Taken: " +mathHours+ "\nComputer Science Hours Taken: " +csHours+ "\nGeneral Ed Hours Taken: " +genEdHours; return str; } }