import java.util.*; import java.io.*; import java.net.*; public class InputGrades { /** *@param argStrings: This the main method, here two scanners *are used in conjunction with two arrays in to take grades (int) *and names (string) from the command line and store them in an array **/ public static void main (String[] argStrings) throws Exception { //-------------------------------------------------------- //Two scanners to pickup names & grades from the command line //-------------------------------------------------------- Scanner inputgrade = new Scanner (System.in); Scanner inputname = new Scanner (System.in); //-------------------------------------------------------- //Two arrays, the first for the grades holding int values, //the second for the names holding string values. //-------------------------------------------------------- int[] grades = new int[5]; String[] names = new String[5]; //------------------------------------------------------- //A loop to run throught the studnets names, each name //is entered in to the names array. Also using the index+1 //feature, i was able to display which student number i was one //-------------------------------------------------------- for (int index = 0; index < names.length; index++) { System.out.print ("\tEnter Name For Student " + (index+1) + ": "); names[index] = inputname.nextLine(); } System.out.println("\t----------------------"); //-------------------------------------------------------- //A loop to run throught the students grades, each grade //is entered in to the grades array. Also i added the names[index] //which displayes the name of the student of which grade you are entering //-------------------------------------------------------- for (int index = 0; index < grades.length; index++) { System.out.print ("\tEnter Grade For " + (names[index]) + ": "); grades[index] = inputgrade.nextInt(); } System.out.println("\t----------------------"); //for (int index = 0; index < grades.lenght && ) //System.out.println("\t" + names.lenght + grades[index]); } }