public class GradStudent extends Student
1: package inheritance;
4: /**
5: * A class that extends Student.
6: *
7: * @author Mark Young (A00000000)
8: */
9: public class GradStudent extends Student {
10:
11: /** GradStudent has a previous degree (BA, BSc, ...) */
12: private String previousDegree;
14: /** GradStudent needs a name and a previous degree */
15: public GradStudent(String n, String pd) {
16: super(n);
17: previousDegree = pd;
18: }
20: /** Return this student's previous degree */
21: public String getPreviousDegree() {
22: return previousDegree;
23: }
25: /** Change this student's previous degree */
26: public void setPreviousDegree(String npd) {
27: this.previousDegree = npd;
28: }
30: @Override
31: public String toString() {
32: return this.getName() + " (" + previousDegree + ")";
33: }
35: }