//=============================================================================
/**
 Undergraduate student.
 @author Geoff Sutcliffe
 @see Student
 */
public class UndergraduateStudent extends Student {
    //-----------------------------------------------------------------------------
    private int standing;  //---1 = freshman, etc
//-----------------------------------------------------------------------------
    /**
     Default constructor.
     */
    public UndergraduateStudent() {

        super();
        this.standing = 1;
    }
//-----------------------------------------------------------------------------
    /**
     Initial value constructor.
     @param name Name of the student.
     @param standing Standing as an integer, 1 = freshman, etc.
     */
    public UndergraduateStudent(String name,int standing) {

        super(name);
        this.standing = standing;
    }
//-----------------------------------------------------------------------------
    /**
     Produce printable information about the undergraduate student.
     @return String.
     */
    public String toString() {

        return(super.toString() + " " + standingString());
    }
//-----------------------------------------------------------------------------
    /**
     Return the standing, converting the integer representation to a string.
     @return String.
     */
    private String standingString() {

        switch (standing) {
            case 1:
                return("Freshman");
            case 2:
                return("Sophomore");
            case 3:
                return("Junior");
            case 4:
                return("Senior");
            default:
                return("Unknown");
        }
    }
//-----------------------------------------------------------------------------
    /**
     Set the grade by finding the average mark and computing the grade.
     @see Student
     */
    public void computeGrade() {

        int index;
        int total;

        total = 0;
        for (index = 0; index < NUMBER_OF_TESTS; index++) {
            if (marks[index] >= 0) {
                total += marks[index];
            }
        }
        grade = gradeFromMark(total / NUMBER_OF_TESTS);
    }
//-----------------------------------------------------------------------------
}
//=============================================================================
