//================================================================= //Menu Selection 3 while (mainSelection == 3) { while (checking_assignments == true) { System.out.println ("How many assignments are there? "); Scanner numOfAssignmentsInput = new Scanner (System.in); numOfAssignments = numOfAssignmentsInput.nextInt (); if ((numOfAssignments) >= 6 || (numOfAssignments) <= 0) { System.out.println ("You have chosen too many assignments, choose a number between 1 and 5"); } else { checking_assignments = false; } } //float[] marksArray3 = new float [numOfAssignments * numOfStudents + 1]; => set this at the top instead for (int q = 0 ; q < numOfAssignments ; q++) // start for at 1 so it doesnt do an extra assignment { System.out.print ("Input what assignment " + (q + 1) + " is out of : "); Scanner outOfInput = new Scanner (System.in); outOf = outOfInput.nextInt (); for (int p = 0 ; p < numOfStudents ; p++) { while (checking_input == true) { System.out.print ("Input the marks for Assignment " + (q + 1) + " for student " + (p + 1) + " :"); Scanner marksInput = new Scanner (System.in); marks = marksInput.nextInt (); if ((marks) > (outOf) || (marks) < 0) { System.out.println ("Invalid input, make sure the mark is LOWER than what it's out of"); } else { total_3 = (float) marks / (float) outOf; //takes marks div by what its out of = a total % for that mark marksArray3 [(q + 1) * numOfStudents - numOfStudents + p] = total_3; // this jumble makes the marks become "stacked" into single array "marksArray3" checking_input = false; } } checking_input = true; } } for (int m = 0 ; m < numOfStudents ; m++) // the following two fors are to take all of the marks per student and solving their average { for (int n = 0 ; n < numOfAssignments ; n++) { total [m] = (float) marksArray3 [n] + (float) total [m]; } overall [m] = total [m] / numOfAssignments; } /*for (int t = 0 ; t < numOfAssignments * numOfStudents ; t++) { System.out.println (marksArray3 [t]); // outputs as %'age }*/ mainSelection = 4; // forces program to go to #4 without choice }