Question: For my Java class I'm having trouble with the following assignment: Standardized Scores A local high school is giving a standardized test to all of

For my Java class I'm having trouble with the following assignment:

Standardized Scores

A local high school is giving a standardized test to all of its students. There are 50 questions on the test and the school would like you 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 will need to download.

Input the data from the file and store the data into an array. To do this, you will have to have your program open the data file, count the number of elements in the file, close the file, initialize your array, reopen the file and load the data into the array.

Then calculate and output the following statistics: average score, the mode of the scores, and the highest/lowest score. In addition, output a list of the scores and the number of students that received each score. (Hint: you may need to use additional arrays to store information.)

Your program should be written using methods and should be well documented internally and externally. Your output should be displayed using Message boxes.

Here is what I have so far:

import java.util.Scanner; import java.io.*; import javax.swing.*; public class scores { public static void main(String[] args) throws IOException { String filename = ("scores.txt"); File file = new File(filename); Scanner inputFile = new Scanner(file); int ctr = 0; while (inputFile.hasNextInt()) { int tempInt = inputFile.nextInt(); ctr++; } inputFile.close(); JOptionPane.showMessageDialog(null,"The file contains "+ctr+" test scores."); } }

Here are the contents of the txt file:

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 20 21 22 23 24 25 20 21 22 23 24 25 26 27 28 29 30 26 27 28 29 30 26 27 28 29 30 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 20 21 22 23 24 25 20 21 22 23 24 25 26 27 28 29 30 26 27 28 29 30 26 27 28 29 30 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 20 21 22 23 24 25 20 21 22 23 24 25 26 27 28 29 30 26 27 28 29 30 26 27 28 29 30 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 35 36 37 38 39 40 41 42 43 44 45 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 38 39 40 41 42 20 21 22 23 24 25 20 21 22 23 24 25 26 27 28 29 30 26 27 28 29 30 26 27 28 29 30 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 31 32 33 34 35 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 40 41 42 43 44 45 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 45 46 47 48 49 50 48 49 50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!