import becker.io.*;
	
	
	
class GradeTracker
{
	int [] quiz1 = new int[30]; // create three arrays: one for each exam
	int [] quiz2 = new int[30]; // in each array, create 30 spots: one for each student
	int [] exam  = new int[30]; // HOW DO YOU KNOW WHICH SPOT GOES WITH WHICH STUDENT???
	
	public void editStudent(int whichStudent, int quiz1Grade, int quiz2Grade, int examGrade)
	{
	}
	
	public double getAverage(int whichArray)
	{
		double total = 0.0;
		// for( ; ; ) // for you to fill out
		{ 			  // Go through, once per student, and....
			
		}
		
		
		return total; // you'll need to change this, too.
	}
	
	public double getStandardDeviation(int whichArray)
	{
		double OverallAverage;
		double Total = 0.0;
		double StdDev;
		int howManyStudents = 0; // this is a counter for the number of students
								// since we need to include only those students 
								// that have actually taken the quiz/exam
		
		// First, we need the formula for standard deviation:
		// stdDev = SquareRootOf( SumOf( (EachStudent'sScore - OverallAverage)^2
		
		
		OverallAverage = getAverage(whichArray);
		
		// for (; ; ) // once per student.....
		//{
		//    int ThisStudentsGrade;
		// 		// figure out how to get the student's grade here.
		// 	    // If the student HASN'T TAKEN THE quiz/exam, DON'T COUNT THEM!!
		//	
		//    if they did take the exam, increment howManyStudents by one
		//    int difference = ThisStudentsGrade - OverallAverage
		// 	  // figure out how to square the diff
		//	  // add the square of the difference to the running Total
		//}   // for loop ends here - go on to the next one
		
		// Total = Total / however many students there are.
		
		StdDev = Math.sqrt(Total); // this calculates the Square Root of Total
		return StdDev;
	}
}

public class BIT_115_A4
{
	public static void main(String[] args)
	{
		// This part works just like that in-class work for allowing the user to
		// tell the robot what to do ("TYpe 1 to turn left, type 2 to turn right", etc, etc)
		int userChoice = -1; // give it a value that will make the while loop true
		TextInput keyboard = new TextInput();
		GradeTracker gradebook = new GradeTracker();
		
		while(userChoice != 0)
		{
			
			System.out.println("Please select one of the following options:");
			
			// NOTE: your menu can have different exact options
			// (i.e., you're not going to lose points, simply because "quit" is choice 1 in your program, or
			// because you've got a menu here for "print class info", and a sub-menu to pick amongst quiz 1, 2, or the exam
			System.out.println("0 - quit");
			System.out.println("1 - edit a student");
			System.out.println("2 - print out info for a single student");
			System.out.println("3 - print out info for quiz 1");
			System.out.println("4 - print out info for quiz 2");
			System.out.println("5 - print out info for exan");
			
			userChoice = keyboard.readInt();
			keyboard.readLine();
				
			if( 1 == userChoice)
			{
				// If the user wants to edit a single student, then we'll need to get
				// the specific info about which student, etc, etc.
				System.out.println("Which student?");
				int studentNum = keyboard.readInt();
				keyboard.readLine();
				
				// you'll need to check that the user entered a number between 0 and 29
				// if they didn't, use the continue command to jump back to the top of the 
				// while loop. To use that command, uncomment the following line:
				// continue; // jump back to the "while(userChoice != 0)" line & re-start
				// the loop
				// NOTE: You can make this work WITHOUT the continue; command
				
				// You could do this a number of ways, we'll go with just asking for all three grades:
				System.out.println("What did that student get for quiz #1?");
				int quiz1 = keyboard.readInt();
				keyboard.readLine();
				
				System.out.println("What did that student get for quiz #2?");
				int quiz2 = keyboard.readInt();
				keyboard.readLine();
				
				System.out.println("What did that student get for the exam?");
				int exam = keyboard.readInt();
				keyboard.readLine();

				gradebook.editStudent(studentNum, quiz1, quiz2, exam);
			}
			if( 2 == userChoice)
			{
			}
			if( 3 == userChoice ||
				4 == userChoice ||
				5 == userChoice)
			{
				int whichQuizOrExam = 1; // 1 means quiz 1, 2 means quiz 2, 3 means the exam
				if(3 == userChoice)      // set it to 1 to keep the compiler happy
				{
					whichQuizOrExam = 1; // 1 means quiz 1
				}		
				if(4 == userChoice)
				{
					whichQuizOrExam = 2; // 2 means quiz 2
				}
				if(5 == userChoice)
				{
					whichQuizOrExam = 3; // 3 means the exam
				}
				
				double average = gradebook.getAverage(whichQuizOrExam);
				System.out.println("The average is: " + average);
				
				double stdDev = gradebook.getStandardDeviation(whichQuizOrExam);
				System.out.println("The standard deviation is: " + stdDev );
				
				// etc.
			}
		}
		
		System.out.println("Thank you for using GradeTracker!");
		System.out.println("Have a nice day!");
	}
}