Ok so here is my problem. I have to write a program where a user can input UP to 25 test scores. The program will then display the scores in a list, then the TOTAL number of test scores that were entered, and then display the highest, lowest, average, etc.

I have a lot of it done, but now I am having trouble with the following: I have to display the total number of test scores entered and I can't figure out how to do that. Then I have the average done however I need the average to be calculated by the number of scores the user entered, not the total number of scores the user CAN input (i hope that makes sense) Then I can't figure out the above average code.

Any help would so be greatly appreciated.

Code:`public class TestData {`

// class fields

private String testName;

private String input;

private final int MAXSIZE = 25;

private int count;

private int scores[];

public TestData() {

testName = JOptionPane.showInputDialog(null, "Input the name for the test. For example, Test1.");

count = 0;

scores = new int[MAXSIZE];

loadArray(scores);

}

private void loadArray(int[] array) { // STORE INPUT IN ARRAY

int testsScore = Integer.parseInt(JOptionPane.showInputDialog

("Input test score and press ENTER (-1 to end)"));

while(testsScore != -1 && count < MAXSIZE) {

scores[count] = testsScore;

count++;

if(count < MAXSIZE) {

testsScore = Integer.parseInt(JOptionPane.showInputDialog(

"Input test score and press ENTER (-1 to end)"));

}

}

}

public void displayResults() { // DISPLAY CONTENTS OF ARRAY AND REST OF OUTPUT

System.out.println(" The results for " + testName);

for(int count = 0; count < scores[count]; count++){

System.out.printf("%5d", scores[count]);

if(count % 10 == 0) {

System.out.println();

}

}

System.out.println(" ");

System.out.printf("THE TOTAL NUMBER OF TEST SCORES %d\n", scores[count]);

System.out.printf("THE NUMBER OF OUTSTANDING SCORES %10d\n", determineOutstanding());

System.out.printf("THE NUMBER OF SATISFACTORY SCORES %10d\n", determineSatisfactory());

System.out.printf("THE NUMBER OF UNSATISFACTORY SCORES %10d\n", determineUnsatisfactory());

System.out.printf("THE AVERAGE SCORES %20f\n", determineAverage());

System.out.printf("THE NUMBER OF ABOVE AVERAGE SCORES %10d\n", determineAboveAverage());

System.out.printf("THE NUMBER OF BELOW AVERAGE SCORES %10d\n", determineBelowAverage());

System.out.printf("THE NUMBER OF HIGHEST SCORES %10d\n", determineHighest());

System.out.printf("THE NUMBER OF LOWEST SCORES %10d\n", determineLowest());

}

private int determineOutstanding() { // COUNT OUTSTANDING SCORES

int outstanding = 0;

for (int i = 0; i < count; i++)

if(scores[i] >= 90)

outstanding++;

return outstanding;

}

private int determineSatisfactory() { // COUNT SATISFACTORY SCORES

int satisfactory = 0;

for (int i = 0; i < count; i++)

if(scores[i] >= 60 && scores[i] <= 89)

satisfactory++;

return satisfactory;

}

private int determineUnsatisfactory() { // COUNT UNSATISFACTORY SCORES

int unsatisfactory = 0;

for (int i = 0; i < count; i++)

if(scores[i] >= 0 && scores[i] <= 59)

unsatisfactory++;

return unsatisfactory;

}

private double determineAverage() { // CALCULATE AVERAGE

double total = 0;

double average;

for (int i = 0; i < count; i++)

total += scores[i];

average = total / scores.length;

return average;

}

private int determineAboveAverage() { // COUNT SCORES ABOVE AVERAGE

double total = 0;

double aboveAverage;

for (int i = 0; i < count; i++)

if(scores[i])

return 0; // so it compiles

}