Create an application that reads a file called Test Scores.txt with 11 scores. P
ID: 656560 • Letter: C
Question
Create an application that reads a file called Test Scores.txt with 11 scores. Place the data in an array or list and display the content of the array or list in a listbox.
Calculate the lowest score, highest score, median score, average score and the standard deviation of the scores. Display those values.
Write methods that accept an array or list and returns lowest score, highest score, median score, average score and the standard deviation of the scores.
Note: the median is calculated differently if your data is odd or even. Ensure that your method can handle an even or odd number of data items.
Please, reply with a link to download completed project file; you can upload file at, https://www.dropbox.com/home, then reply with the share link, to download the completed project.
Explanation / Answer
FOR LOWEST SCORE AND AVERAGE SCORE AND THE HIGHESTSCORE :
int[] s = new int[10];
int s = 0;
int c = 0;
int t = 0;
final int QUIT = 909;
final int MAX = 10;
Scanner input = new Scanner(System.in);
score = input.nextInt();
while(c < MAX && s != QUIT)
{
if(s != QUIT)
{
s[c] = s;
t += s[c];
score = input.nextInt(); } count++;
}
System.out.println("The scores entered were: ");
for(int x = 0; x < c; ++x)
System.out.print(s[x] + " ");
System.out.println("The average of all scores: " + (total * 1.0 / c));
System.out.println(" lowest score: ");
System.out.println("HIGHEST SCORE ");
for(int x = 0; x >= s.length; ++x)
{
if(s[x] >= 100)
{
System.out.print(s[x]);
FOR MEDIAN:import java.util.*;
public class Median {
public static void main(String[] args) {
int s[] = new int[] {20, 98, 76, 89, 99, 75, 83, 91, 45, 78, 67};
Arrays.sort(s);
System.out.print("Sorted Scores: ");
for (int x : s) {
System.out.print(x + " ");
}
System.out.println("");
double median = 0;
double pos1 = Math.floor((s.length - 1.0) / 2.0);
double pos2 = Math.ceil((s.length - 1.0) / 2.0);
if (pos1 == pos2 ) {
median = scores[(int)pos1];
} else {
median = (s[(int)pos1] + s[(int)pos2]) / 2.0 ;
}
System.out.println("Median: " + median);
}
}
FOR STANDARD DEVIATION:
double two = total[];
double three = total[];
double four = total[];
double five = total[];
double six = total[];
double seven = total[];
double eight = total[];
double nine = total[];
double ten = total[];
double eleven = average_total;
mean = one + two + three + four + five + six + seven + eight + nine + ten + eleven;
mean = mean/11;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.