/**
 * Student series demonstrates encapsulation by representing a student in a class
 * Student04 - adds two constructors
 *
 * @author Tim Pierson, Dartmouth CS10, Winter 2025
 */
public class Student04 {
    protected String name;
    protected int graduationYear;

    public Student04() {
        //default constructor: you get this by default
    }

    public Student04(String name, int year) {
        this.name = name;
        graduationYear = year;
    }

    /**
     * Setters for instance variables
     */
    public void setName(String name) { this.name = name; }
    public void setYear(int year) {
        //only accept valid years
        if (year > 1769 && year < 2100) {
            graduationYear = year;
        }
    }

    /**
     * Getters for instance variables
     */
    public String getName() { return name; }
    public int getGraduationYear() { return graduationYear; }




    public static void main(String[] args) {
        Student04 abby = new Student04(); //calls first constructor
        Student04 alice = new Student04("Alice", 2027); //calls second constructor
        System.out.println("Name: " + abby.name +
                ", Year: " + abby.graduationYear);
        System.out.println("Name: " + alice.name +
                ", Year: " + alice.graduationYear);
    }
}