import java.*; /** * Student grade book. * * @author put your name here */ public class HW3 { /** * Test driver. * * @param args Unused.

import java.util.*;/** * Student grade book. * * @author put your name here */public class HW3 {/*** Test driver.** @param args Unused.*/public static void main(String [] args) {// the class listTreeMap<String,TreeMap<String,Integer>> classList =new TreeMap<String,TreeMap<String,Integer>>();// prompt for and read commandsScanner input = new Scanner(System.in);System.out.print(“Enter a command: “);while (input.hasNextLine()) {String command = input.nextLine();// if end, doneif (command.equals(“end”)) {break;}// if addstudent, get name and do itelse if (command.equals(“addstudent”)) {System.out.print(“Enter student’s name: “);String name = input.nextLine();addStudent(classList,name);}// if removestudent, get name and do itelse if (command.equals(“removestudent”)) {System.out.print(“Enter student’s name: “);String name = input.nextLine();removeStudent(classList,name);}// if entergrade, get info and do itelse if (command.equals(“entergrade”)) {System.out.print(“Enter student’s name: “);String name = input.nextLine();System.out.print(“Enter assignment name: “);String assgn = input.nextLine();System.out.print(“Enter score (int): “);int score = Integer.parseInt(input.nextLine());enterGrade(classList,name,assgn,score);}// if changegrade, get info and do itelse if (command.equals(“changegrade”)) {System.out.print(“Enter student’s name: “);String name = input.nextLine();System.out.print(“Enter assignment name: “);String assgn = input.nextLine();System.out.print(“Enter new score (int): “);int score = Integer.parseInt(input.nextLine());changeGrade(classList,name,assgn,score);}// if printstudent, get name and do itelse if (command.equals(“printstudent”)) {System.out.print(“Enter student’s name: “);String name = input.nextLine();printStudent(classList,name);}// if gradestats, get assignment name and do itelse if (command.equals(“gradestats”)) {System.out.print(“Enter assignment name: “);String assgn = input.nextLine();gradeStats(classList,assgn);}// otherwise the command is invalidelse {System.out.println(“Invalid command”);}// print the map so far and prompt for the next commandSystem.out.println(“Map: ” + classList);System.out.print(“Enter a command: “);}} // end of main method/*** Add a student to the class list.* If there already is a student with the same name, just print an error* message.** @param list The class list.* @param name The student’s name.*/public static voidaddStudent(TreeMap<String,TreeMap<String,Integer>> list,String name) {} // end of addStudent method/*** Remove a student from the class list.* If the student isn’t in the list, just print an error message.** @param list The class list.* @param name The student’s name.*/public static voidremoveStudent(TreeMap<String,TreeMap<String,Integer>> list,String name) {} // end of addStudent method/*** Enter a grade on an assignment for a particular student.* If the student isn’t in the class list, just print an error message.* If the assignment is already in this student’s list, just print an error* message.* If the score is less than 0 or greater than 100, just print an error* message.** @param list The class list.* @param name The student’s name.* @param assgn The assignment name.* @param score The score.*/public static voidenterGrade(TreeMap<String,TreeMap<String,Integer>> list,String name, String assgn, int score) {} // end of enterGrade method/*** Change the grade on a particular assignment for a particular student.* If the student isn’t in the class list, just print an error message.* If the assignment isn’t in this student’s list, just print an error* message.* If the score is less than 0 or greater than 100, just print an error* message.** @param list The class list.* @param name The student’s name.* @param assgn The assignment name.* @param score The score.*/public static voidchangeGrade(TreeMap<String,TreeMap<String,Integer>> list,String name, String assgn, int score) {} // end of changeGrade method/*** Print the name of the student, all their scores, and their average score.* If the student isn’t in the class list, just print an error message.** @param list The class list.* @param name The student’s name.*/public static voidprintStudent(TreeMap<String,TreeMap<String,Integer>> list,String name) {} // end of printStudent method/*** Print min, max and average scores for a particular assignment over all* the students.** @param list The class list.* @param assgn The assignment name.*/public static voidgradeStats(TreeMap<String,TreeMap<String,Integer>> list,String assgn) {} // end of gradeStats method} // end of HW3 classThe main method prompts the user for various commands to be applied to the class list, and for information for those commands. The commands are:addstudent – add a new student to the class listremovestudent – remove an existing student from the class listentergrade – enter a score for a new assignment for a given studentchangegrade – change a score for an existing assignment for a given studentprintstudent – print the name and all scores for a given studentgradestats – print the min, max and average score for a given assignment over all the studentsEach command is performed by a method of essentially the same name. Skeleton code for these methods already exists in the code above, along with appropriate documentation for the methods. Your task is to write code to make the methods do what they are supposed to do.