I would not be posting right now if it weren't for the fact that I've exausted my resources and have no where else to turn for a solution.

First of all, let me give you guys a .class file, that when compiled, does exactly what my program is -supposed- to do.

finished program

Now that you know what my program is supposed to do, here is the program I have:

import static java.lang.System.out;
import java.util.Scanner;

public class StuTest
{
   private static Scanner keyboard = new Scanner(System.in);

   public static void main(String[] args)
   {
      int[][] testScores; // [students][tests]
      String[] stuNames;

      testScores = createArray();
      if(testScores != null)
      {
         stuNames = new String[testScores.length];
         populateNames(stuNames);
         populateTestScores(stuNames,testScores);
         printStudentReport(stuNames,testScores);
         printTestReport(stuNames,testScores);
         out.println("\n\nGoodbye!\n\n");
      }
      else
      {
         out.println("Array not successfully created - exiting");
      }
   }

   // Code your 5 methods below..
   // Ask user to enter the number of students, and then asks user to enter the number of tests.
   private static int numberOfStudents;
   private static int numberOfTests;
   public static int[][] createArray()
   {
       System.out.print("Enter the number of students: ");
       numberOfStudents = keyboard.nextInt();
       System.out.print("Enter the number of tests: ");
       numberOfTests = keyboard.nextInt();
       System.out.println();
       System.out.println();
       int[][] stuArray = new int[numberOfStudents][numberOfTests];
       return stuArray;
   }
   // Ask for the name of each student for each number of students
   public static String[] populateNames(String[] stuNames)
   {
       for(int x = 0; x < stuNames.length; x++)
       {
	       System.out.print("Enter the name for student " + (x + 1) + ": ");
	       keyboard = new Scanner(System.in);
		   stuNames[x] = keyboard.nextLine();
       }
	   return stuNames;
   }
   // Display "Entering Scores for (Student Name)" then input the score for each test.
   public static int[][] populateTestScores(String[] stuNames, int[][] testScores)
   {
      for(int y = 0; y < stuNames.length; y++)
      {
		  for(int u = 0; u < stuNames.length; u++)
		  {
              System.out.println("Entering scores for " + stuNames[y]);
    	      System.out.print("        Enter score for Test " + testScores + ": ");
    	      testScores[y][u] = keyboard.nextInt();
	      }
      }
      return testScores;
   }
   // Print Student Report
   public static void printStudentReport(String[] stuNames, int[][] testScores)
   {
	   // Print the name of each student and the scores for each of the student's tests
       System.out.println("STUDENT REPORT");
       for(int z = 1; z <= stuNames.length; z++)
       {
		   System.out.println("Report for " + stuNames[z]);
		   for(int a = 1; a <= numberOfTests; a++)
		   {
		       System.out.println("        Test " + a + ": " + testScores[a][z]);
		   }
		   // Print the average of the student's tests
		   int p = 0;
		   for(int o = 1; o <= testScores.length; o++)
		   {

			   p += testScores[o][z];
		   }
		   p /= testScores.length;
		   System.out.println("        " + stuNames[z] + "'s average is " + p);
	   }
       // Print Test Report
   }
   public static void printTestReport(String[] stuNames, int[][] testScores)
   {
       System.out.println("TEST REPORT");
       // Print the results for each individual test, and the average for each test
       for(int b = 1; b <= testScores.length; b++)
       {
		   System.out.println("Report for Test" + b);
		   for(int c = 1; c <= numberOfStudents; c++)
		   {
		       System.out.println("        Test " + c + ": " + testScores[c][b]);
		   }
		   int p = 0;
		   for(int o = 1; o <= testScores.length; o++)
		   {
		   	   p += testScores[o][b];
		   }
		   p /= testScores.length;
		   System.out.println("        Test" + b + " average is " + p);
	   }

   }
}

If you throw that into your compiler, it will compile, but gives several runtime errors resulting in a crash.. What happens is that when I get to the "Entering scores for test", the test numbers do not show up correctly. It prints out the student report inproperly and does not print out the test report at all, it just crashes.

What's the error message you are recieving(if any)?

Also, Im too lazy to put that into a compiler and read through all the source, so please explain what it's doing that it's not suppose to in detail.

Well it might take awhile to explain, the best and easiest thing for you and me would be to take a look at the .class file I have and then compile the code I have and compare the two. But I will try to explain... What it does is ask for the number of students, and then the number of tests. Then it should ask for the names of each student. Then it asks for the test scores for each student. After that, it gives a student report which has the scores and average for each individual, and then a test report that has the scores and average for each test.

no, the best way is for you to think about your problems yourself.
If you're too lazy to even try to explain what is going wrong why should anyone go to the effort (especially unpaid) to analyse your problems for you?

no, the best way is for you to think about your problems yourself.
If you're too lazy to even try to explain what is going wrong why should anyone go to the effort (especially unpaid) to analyse your problems for you?

If you throw that into your compiler, it will compile, but gives several runtime errors resulting in a crash.. What happens is that when I get to the "Entering scores for test", the test numbers do not show up correctly. It prints out the student report inproperly and does not print out the test report at all, it just crashes.

.

You don't say what happens, nor what's supposed to happen.
Then you say you can't be bothered to be more specific.

This article has been dead for over six months. Start a new discussion instead.