/** Detail record is an abstract class which represents transcript
    details.  Each individual record will be of a different type
 	
	 @author Nancy Harris, James Madison University
	 @version V1 03/23/2008
*/
abstract public class DetailRecord
{
	private int year;
	private int term;
	private String course;
	private int hours;
	
	/** Explicit value constructor used by children of this class
	 * Hours are validated and if not in the range, are set
	 * to zero.
	 *
	 * @param year The year for this detail
	 * @param term The month number in which the term begins
	 * @param course The course identifier (ie. Math 220)
	 * @param hours The credit hours for this class
	 */
	protected DetailRecord(int year, int term, String course, int hours)
	{
		this.year = year;
		this.term = term;
		this.course = course;
		if (hours >= 0 && hours <= 12)
			this.hours = hours;
		else
			this.hours = 0;
	}
	
	/** getCreditHours returns the credit hours for this object
	 *
	 * @return the credit hours for this detail
	 */
	public int getCreditHours()
	{
		return hours;
	}
	
	abstract public Grade getGrade();
	abstract public int getGradedHours();
	abstract public int getEarnedHours();
	abstract public double getQualityPoints();
	abstract public String getDescription();
	
	public String toString()
	{
		return String.format("%4d %4d %-50s %5d %-5s", 
			year, term, getDescription(),hours, getGrade().getGrade());
	}
	
	public String getCourse()
	{
		return course;
	}
}
