Help with an Array Assignment



I need help with this assignment. Am I on track? Here is the code that I
have so far.

A school is giving a standardized test to all of its students. There are 50
questions on the test and the school would like to gather some statistics on
how the students performed. Scores can range anywhere from 0 to 50. All the
scores are stored in a file (scores.txt) that you can download. Read the data
from the file and calculate and output the following statistics: average
score, the mode of the scores, the highest/lowest score. In addition, output
a list of the scores and the number of students that received each score.

import java.io.*;
import java util.*;

public static void main (String [ ] args) throws FileNotFoundException
{
int [ ] scores = new int [50];
Scanner inFile = new Scanner(new FileReader (f:\\scores.txt));;

readData(inFile, scores);
print(scores);
System.out.println();
}

public static void readData(Scanner inputFile, int[] list)
{
int score;
int index;

while (inputFile.hasNext())
{
score = inputFile.nextInt();
index = score / ???;

if (index == list.length)
index--;
if (index < list.length)
list[index]++;
}
}

public static void print(int[] list)
{
int range;
int lowRange = 0;
int upperRange = 50;

System.out.println(" Range # of Students");

for (range = 0; range < list.length; range++)
{
System.out.printf("%4d - %3d %10d%n", lowRange,
upperRange, list[range]);
lowRange = upperRange + 1;
upperRange = upperRange + 25;
if (range == list.length - 2)
upperRange++;
}
System.out.println();
}
}
.



Relevant Pages

  • Re: Iowqa School to get Laptops
    ... CENTRAL CITY - Soon students in the Central City School ... Snit will now produce evidence that using computers in education ...
    (comp.sys.mac.advocacy)
  • Learning from Poor Minority Students....
    ... Learning from Poor and Minority Students Who Succeed in School ... This is one family's story of success against the odds. ... Relative to the voluminous literature on the causes of school failure, ...
    (soc.culture.hmong)
  • Re: "The National Anthem should be sung in English" - What part of "unconstitutional" do conserv
    ... spent my entire pre-college education in Catholic schools. ... grammar/English are now drilled into the heads of students for countless ... hours in the school day immersed in just those two subjects (with an hour ... party)...also develops one's critical thinking skills. ...
    (rec.music.artists.springsteen)
  • Re: So, heres the (hopefully) next topic of debate
    ... about my schooling to become a goldsmith. ... >> I thought I was getting a great education - especially at Cranbrook...it was ... >> school I was amazed. ... >> throw lots of conceptual ideas at the students using found objects and glue ...
    (rec.crafts.jewelry)
  • Re: DAVE school
    ... extremely proud of the DAVE School and think I need to speak up. ... You should communicate this to the students. ... Or perhapps a teacher is misquoting the policy. ... We think that learning about things AND having our ...
    (comp.graphics.apps.lightwave)