Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The program is to print the student scores and calculate and print the statistic

ID: 3675113 • Letter: T

Question

The program is to print the student scores and calculate and print the statistics for each quiz. The output is in the same order as the input; no sorting is needed. The input is to be read from a text file. The output from the program should be similar to the following:

In this assignment create and implement an interface to:

Print student statistics.

Print scores for a given student id.

implement the Debug flag globally

Think of possible opportunities for using an Abstract class. Create and implement an abstract class in the assignment.

Here is a copy of actual data to be used for input.

Stud Qu1 Qu2 Qu3 Qu4 Qu5

1234 052 007 100 078 034

2134 090 036 090 077 030

3124 100 045 020 090 070

4532 011 017 081 032 077

5678 020 012 045 078 034

6134 034 080 055 078 045

7874 060 100 056 078 078

8026 070 010 066 078 056

9893 034 009 077 078 020

1947 045 040 088 078 055

2877 055 050 099 078 080

3189 022 070 100 078 077

4602 089 050 091 078 060

5405 011 011 000 078 010

6999 000 098 089 078 020

Here is some sample data (not to be used) for calculations:

Stud Q1 Q2 Q3 Q4 Q5

1234 78 83 87 91 86

2134 67 77 84 82 79

1852 77 89 93 87 71

High Score 78 89 93 91 86

Low Score 67 77 84 82 71

Average     73.4    83.0    88.2     86.6    78.6

Explanation / Answer

import corejava.*;
import java.io.*;
class Student
{
String id, quiz1, quiz2, quiz3, quiz4, quiz5;
void print()
{
}
static void buildStudent(Student s[][])
{
for(int i = 0; i < 40; i++)
{
for(int j = 0; j < 6; j++)
{
s[i][j] = new Student();
}
}
}
static void read(Student s[][])
{
try
{
FileReader file = new FileReader("Data.txt");
BufferedReader buff = new BufferedReader(file);
boolean eof = false;
while (!eof)
{
String line = buff.readLine();
if(line == null)
{
eof = true;
}
else
{
String[] result = line.split("\s");
for(int i = 0; i < 25; i++)
{
for(int j = 0; j < 6; j++)
{
s[i][j] = new Student(result[0], result[1], result[2], result[3], result[4], result[5]);
}
}
}
}
buff.close();
}
catch(IOException e)
{
System.out.println("Error --" + e.toString());
}
}
Student()
{
}
Student(String id, String quiz1, String quiz2, String quiz3, String quiz4, String quiz5)
{
this.id = id; this.quiz1 = quiz1; this.quiz2 = quiz2; this.quiz4 = quiz4; this.quiz5 = quiz5;
}
public static void main (String [] args)
{
Student[][] s = new Student[40][6];
Student.buildStudent(s);
Student.read(s);
System.out.println(s[0][0].id);
}
}