public class Student
{
	int SID;
	String fname, lname;
	double totalpoints;
	int totalcredits;
	double gpa;

	public Student()
	{
	}

	public Student(int SID, String fname, String lname)
	{
		this.SID=SID;
		this.fname=fname;
		this.lname=lname;
	}


	public void setSID(int SID){this.SID=SID;}
	public void setFName(String fname){this.fname=fname;}
	public void setLName(String lname){this.lname=lname;}

	public int 	  getSID(){return SID;}
	public String getFName(){return fname;}
	public String getLName(){return lname;}



	public void AddClass(Course st_class)
	{
		Registration temp = new Registration(st_class, this);
								//'this' means the current Student object
								//from which the method was called

		College_Menu.regs.add(temp);
	}


	public void DropClass(Course st_class)
	{
		for(int i = 0; i < College_Menu.regs.size(); i++)
		{
			if(((Registration)College_Menu.regs.get(i)).getCourse() == st_class)
			{
				College_Menu.regs.remove(i);
			}
		}
	}


	public String ViewTranscript()
	{
		totalpoints = 0;
		totalcredits = 0;
		gpa = 0;

		String transcript = "\n\nTranscript for "+getFName() + " " + getLName()
							+ ", StudentID "+getSID()
							+"\n----------------------------------------------\n";

		for(int i = 0; i < College_Menu.regs.size(); i++)
		{
			if(((Registration)College_Menu.regs.get(i)).getStudent()==this)
			{
				Registration r = ((Registration)College_Menu.regs.get(i));

				transcript += (r.getCourse()).toStringTranscript()+r.getGrade() + "\n";
				calcGPA(r.getGrade(), (r.getCourse().getNumCredits()));
			}
		}

		transcript+=("\nTotal Credits: " + totalcredits +
		    		"\nGPA: " + gpa + "\n");

		return transcript;
	}


	public double calcGPA(double grade, int credit)
	{
		totalpoints = totalpoints+(grade*credit);
		totalcredits = totalcredits+(credit);
		gpa = totalpoints/totalcredits;
		return gpa;
	}


	public String toString()
	{
		String st_info = ( "Student ID1: " + SID
						+ "\nFirst Name: " + fname
						+ "\nLast Name: " + lname);
		return st_info;
	}
	public String toStringRoster()
	{
		String roster = (SID + "\t" +fname+"\t"+lname);
		return roster;
	}
}
