Question: Part 1: None Part 2: Programming: (20 points) Write a program that reads students' quizzes scores from a file (quiz.txt), and computes the statistics and

\Part 1: None

Part 2: Programming: (20 points) Write a program that reads students' quizzes scores from a file (quiz.txt), and computes the statistics and returns a report of student average by dropping the lowest quiz grade. Download the following files and use them for this assignment. (Do not change the content of the following files.) Assignment8.java & quiz.txt the quiz.txt is an input file (text file) that has the quiz scores for each student. Save both files in the same folder. You will be creating a class called QuizData. This class is defined in a file named "QuizData.java".

The class QuizData will contain a 2 dimensional array, an integer to keep track of number of students enrolled in class, and an integer to keep track of number of the quizzes for each student.

Method

Description of the Method

public QuizData(String filename) 

It instantiates the 2- dimensional array by reading from the file. The first line in the input file (filename) contains the number of students (number of rows), and the second integer is the number of quizzes (number of columns) for each student. After instantiating, your 2-D array then you read the quizzes from the file to initialize the 2-D array.

public double quizAverage( ) 

It returns the overall quiz average without dropping any quiz.

public String studentStatistics( ) 

It returns a report of student average quiz score after dropping the lowest quiz grade.

public String quizStatistics( ) 

It returns a report of each quiz statistics, the lowest, highest, and the average for each quiz

public String toString( ) 

The toString method returns the 2-D array- see the sample output.

//------------------------------------------------------------------------- // FILENAME: Assignment8.java // DESCRIPTION: This is the test driver for QuizData class. It provides the stduent and quiz statistics for // a class. It reads the data from a file that includes the students' quiz scores. // FOR: CSE 110 Assignment 8 // DUE DATE: // Time Spent: //------------------------------------------------------------------------- import java.text.DecimalFormat; import java.io.*; public class Assignment8 { public static void main(String[] args) throws IOException { //instantiate a QuizData object by passing the file name QuizData cmp = new QuizData("quiz.txt"); DecimalFormat averageFormat = new DecimalFormat( "0.00" ); System.out.println(cmp.toString()); // it prints the scores for all stdudents //print the average of quiz scores, no quiz is dropped System.out.println(" Average of all quizzes (no quizzes dropped) = " + averageFormat.format( cmp.quizAverage( ) ) ); System.out.println(" Statistics for each quiz " ); System.out.println(cmp.quizStatistics( )); System.out.println(" A Statistics for each student" ); System.out.println( cmp.studentStatistics( ) ); } } 
quiz.txt 11 6 67.8 56.4 88.4 79.1 90.0 66.0 76.4 81.1 72.2 76.0 85.6 85.0 87.8 76.4 88.7 83.0 76.3 87.0 86.4 54.0 40.0 3.0 2.0 1.0 72.8 89.0 55.0 62.0 68.0 77.7 94.4 63.0 92.9 45.0 75.6 99.5 85.8 95.0 88.1 100.0 60.0 85.8 76.4 84.4 100.0 94.3 75.6 74.0 57.9 49.5 58.8 67.4 80.0 56.0 86.1 76.0 72.0 88.1 55.6 71.3 87.2 95.5 98.1 97.0 98.0 99.0 

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!