package edu.oakland.OUSoft.items;

import java.util.Objects;

/**
 * "A student class should contain more information such as the number of years in college,"
 */
public class Student extends Person {
	
	private String major;
	
	private int numYearsAttended;
	
	private double GPA;
	
	/**
	 * Create a Student with an ID
	 *
	 * @param ID The ID of the Student
	 */
	public Student(String ID) {
		super(ID);
	}
	
	/**
	 * Create a Student with an ID, first name, and last name.
	 *
	 * @param ID        The ID of the Student
	 * @param firstName The first name of the Student
	 * @param lastName  The last name of the Student
	 */
	public Student(String ID, String firstName, String lastName) {
		super(ID, firstName, lastName);
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!super.equals(obj) || !(obj instanceof Student)) {
			return false;
		}
		Student o = (Student) obj;
		return Objects.equals(this.major, o.major) &&
		       Objects.equals(this.numYearsAttended, o.numYearsAttended) &&
		       Objects.equals(this.GPA, o.GPA);
	}
	
	@Override
	public String toString() {
		return super.toString() + ", Student. Major: " + this.major + ". Years attended: " + this.numYearsAttended;
	}
	
	public String getMajor() {
		return major;
	}
	
	public void setMajor(String major) {
		this.major = major;
	}
	
	public int getNumYearsAttended() {
		return numYearsAttended;
	}
	
	public void setNumYearsAttended(int numYearsAttended) {
		this.numYearsAttended = numYearsAttended;
	}
	
	public double getGPA() {
		return GPA;
	}
	
	public void setGPA(double GPA) {
		if (GPA < 0 || GPA > 4.0) {
			throw new IllegalArgumentException("GPA out of bounds");
		}
		this.GPA = GPA;
	}
}

@@ -191,16 +191,47 @@
 s Person
+ implements Comparable%3CStudent%3E
  %7B%0A%09%0A%09pr
@@ -1714,10 +1714,191 @@
 GPA;%0A%09%7D%0A
+%09%0A%09public float getGPAOutOf100() %7B%0A%09%09return (float) (GPA * 25);%0A%09%7D%0A%09%0A%09@Override%0A%09public int compareTo(Student o) %7B%0A%09%09return (int) ((this.getGPA() * 1000) - (o.getGPA() * 1000));%0A%09%7D%0A
 %7D%0A

Implement Comparable in Student