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

Hi I need help with this java project. Kindly follow the instructions that given

ID: 3913052 • Letter: H

Question

Hi I need help with this java project. Kindly follow the instructions that given below thank.

The table is the data that you use to build the table you will be creating in your database. If you run the program as is, and use that table which is an excel sheet, the program will read the data in that sheet. The project needs to create the database and a table and load records into this table, then change the program to read this table instead if reading it from the excel sheet

Here is the Source code link for (TestScoreReader): http://www.jade-cheng.com/hpu/2012-spring/csci-2912/text-processing-and-wrapper-classes-ii/TestScoreReader.java.

And (TestAverages)http://www.jade-cheng.com/hpu/2012-spring/csci-2912/text-processing-and-wrapper-classes-ii/TestAverages.java?

Dr. Harrison keeps student scores in an Excel file. This can be exported as a comma separated text file. Each student's data will be on one line. We want to write a Java program that will find the average for each student. (The number of students changes each year.) Modify the source code included to do the TestAverages java TestScoreReader.java following: Instead of reading the data from the Excel spreadsheet, Create a database called Classes and a table called Grades with the fields and data as specified in the Excel attached. 87 72 94 79 79 92 56 82 91 81 81 67 85 82 74 89 81 81 94 96 79 90 79 Analysis (Describe the problem including input and output in your own words.) Design: (Describe the major steps for solving the problem.)

Explanation / Answer

TestAverage.java

import java.io.*; // Needed for IOException

/**

This program uses the TestScoreReader class

to read test scores from a file and get

their averages.

*/

public class TestAverages

{

public static void main(String[] args)

throws IOException

{

double average; // Test average

int studentNumber = 1; // Control variable

  

// Create a TestScoreReader object.

TestScoreReader scoreReader =

new TestScoreReader("Grades.csv");

  

// Display the averages.

while (scoreReader.readNextLine())

{

// Get the average from the TestScoreReader.

average = scoreReader.getAverage();

// Display the student's average.

System.out.println("Average for student " +

studentNumber + " is " +

average);

// Increment the student number.

studentNumber++;

}

  

// Close the TestScoreReader.

scoreReader.close();

System.out.println("No more scores.");

}

}

TestScoreReader.java

import java.io.*;

import java.util.Scanner;

/**

The TestScoreReader class reads test scores as

tokens from a file and calculates the average

of each line of scores.

*/

public class TestScoreReader

{

private Scanner inputFile;

private String line;

/**

The constructor opens a file to read

the grades from.

@param filename The file to open.

*/

public TestScoreReader(String filename)

throws IOException

{

File file = new File(filename);

inputFile = new Scanner(file);

}

/**

The readNextLine method reads the next line

from the file.

@return true if the line was read, false

otherwise.

*/

public boolean readNextLine() throws IOException

{

boolean lineRead; // Flag variable

  

// Determine whether there is more to read.

lineRead = inputFile.hasNext();

// If so, read the next line.

if (lineRead)

line = inputFile.nextLine();

return lineRead;

}

/**

The getAverage method calculates the average

of the last set of test scores read from the file.

@return The average.

*/

  

public double getAverage()

{

int total = 0; // Accumulator

double average; // The average test score

// Tokenize the last line read from the file.

String[] tokens = line.split(",");

  

// Calculate the total of the test scores.

for (String str : tokens)

{

total += Integer.parseInt(str);

}

  

// Calculate the average of the scores.

// Use a cast to avoid integer division.

average = (double) total / tokens.length;

  

// Return the average.

return average;

}

/**

The close method closes the file.

*/

public void close() throws IOException

{

inputFile.close();

}

}