/*
 * Student2.java
 *
 * A blueprint class for representing students at a university.
 *
 * Author: S-111 Course Staff
 */
public class Student2 {

    private String firstName;
    private String lastName;
    private int yearOfGraduation;

    /*
     * Constructors
     */
    public Student2(String firstName, String lastName, int gradYear) {
        if (firstName == null || firstName.equals("")) {
            throw new IllegalArgumentException("first name cannot be null or empty");
        }

        if (lastName == null || lastName.equals("")) {
            throw new IllegalArgumentException("last name cannot be null or empty");
        }

        this.firstName = firstName;
        this.lastName = lastName;
        this.yearOfGraduation = gradYear;
    }


    /*
     * Accessor methods
     */
    public String getFirstName() {
        return this.firstName;
    }

    public String getLastName() {
        return this.lastName;
    }

    public int getYearOfGraduation() {
        return this.yearOfGraduation;
    }

    public String getFullName() {
        return this.getFirstName() + " " + this.getLastName();
    }


    /*
     * Mutator methods
     */
    public void setYearOfGraduation(int newYear) {
        if (newYear < this.yearOfGraduation) {
            throw new IllegalArgumentException("graduation cannot be moved back");
        }

        this.yearOfGraduation = newYear;
    }
}

