Source of GradStudent.java


  2: /**
  3:  * A class that extends Student.
  4:  *
  5:  * @author Mark Young (A00000000)
  6:  */
  7: public class GradStudent extends Student {
  8:     
  9:     /** 
 10:      * GradStudent has a previous degree (BA, BSc, ...) 
 11:      */
 12:     public final String previousDegree;

 14:     /** 
 15:      * GradStudent needs a name and a previous degree 
 16:      *
 17:      * @param name the Student's name
 18:      * @param degree the Student's previous degree
 19:      */
 20:     public GradStudent(String name, String degree) {
 21:         super(name);
 22:         previousDegree = degree;
 23:     }

 25:     /** 
 26:      * Return this student's previous degree 
 27:      *
 28:      * @return this student's previous degree 
 29:      */
 30:     public String getPreviousDegree() {
 31:         return previousDegree;
 32:     }

 34:     /**
 35:      * Return a String representing this Student. Include their previous
 36:      * degree.
 37:      *
 38:      * @return a String represetning this GradStudent
 39:      */
 40:     @Override
 41:     public String toString() {
 42:         return this.getName() + " (" + previousDegree + ")";
 43:     }

 45: }