//File:	Student.java
import iostuff.*;
class Student
{
	//Data fields
	private String name;
  	private int [] exam;
  	private int number_of_scores;

  	//Constructor
  	public Student ()
  	{
  		exam = new int [15];
  	}
  	
  	public Student (String person, int n)
  	{
  		name = person;
  		exam=new int [n];
  		number_of_scores=n;
  	}
  	
  	
 	//Accessor methods
 	public String getName ()
  	{
  		return name;
  	}

	public int getExam (int which)
	{
		return exam [which-1];
	}
	  	

  	public int average ()
  	{
  		int sum=0;
  		for (int k=0; k<number_of_scores; k++)
  		{
  			sum=sum+exam[k];
  		}
  		return sum/number_of_scores;
  	}
  	
  	//Mutator methods
  	public void setName (String s)
  	{
  		name = s;
  	}
  	
	public void setExam (int which, int s)
	{
		exam[which-1] = s;
	}
	
	public void setNumberOfScores(int n)
	{
		number_of_scores=n;
	}
	
	
	//The following two methods should make the dropLowestGrade()
	//method required in Homework #5 much easier
	
	//The following method returns the index of the smallest
	//exam score.
	public int smallestIndex()
	{
		int smallest=0;
		for (int k=1; k<number_of_scores; k++)
		{
			if (exam[k] < exam[smallest])
				smallest=k;
		}
		return smallest;
	}
	
	//The following method accomplishes the exchange of
	//exam[i] and exam[j].  For example, this would allow you to place
	//the lowest exam score "out of the way", at the end of the
	//list of exam scores.
	public void swap (int i, int j)
	{
		int temp=exam[i];
		exam[i] = exam[j];
		exam[j] = temp;
	}
			
        //Required for Homework #5
        //precondition: exam[0], exam[1], exam[2], ..., exam[numberOfScores-1]
        public void dropLowestGrade()
        {
        }
        //postcondition: exam[numberOfScores-1] contains smallest score in list
        //             numberOfScores = numberOfScores-1
         
        //The following is just a "dummy" version of the
        //standard deviation algorithm.  You'll rewrite it to 
        //do the job required.
        public int standardDeviation()
        {
        	return 1;
        }
}