Inheritance+Nov.18th.2016

code public class Student { public final static int NUM_TESTS = 3; private String name; private int[] tests; private String grade;

public Student{ name=""; tests=new int[NUM_TESTS]; grade=""; }	public Student(String studName,int[]studTests,String studGrade){ name=studName; tests=studTests; grade=studGrade; }	public String getName{ return name; }	public String getGrade{ return grade; }	public void setGrade(String newGrade){ grade=newGrade; }	public void computeGrade{ if (name.equals("")){ grade="No grade"; }		else if (getTestAverage>=65){ grade="Pass"; }		else{ grade="fail"; }	}	public double getTestAverage{ double total=0; for(int score:tests){ total+=score; }		return total/NUM_TESTS; } }

code code

public class UnderGrad extends Student{

public UnderGrad {super;}

public UnderGrad(String studName,int[] studTests,String studGrade){ super(studName,studTests,studGrade);}

public void computeGrade{ if (getTestAverage>=70) setGrade("Pass"); else{ setGrade("Fail"); }		 }	}

code code

public class GradStudent extends Student { private int gradID; public GradStudent{ super; gradID=0; }	public GradStudent(String studName,int[] studTests,String studGrade, int gradStudID){ super(studName,studTests,studGrade); gradID=gradStudID; }

public int getID{ return gradID; }

public void computeGrad{ super.computeGrade; if (getTestAverage>=90){ setGrade("Pass with distinctoin"); }	} }

code