Question: Hi I need help with java problem. 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. import java.io.*; import java.util.Scanner; /** The TestScoreReader class reads

Hi I need help with java problem.

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.

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(); } }

And (TestAverages) source code: http://www.jade-cheng.com/hpu/2012-spring/csci-2912/text-processing-and-wrapper-classes-ii/TestAverages.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."); } }

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

Hi I need help with java problem. Here is the Source code

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 91 81 81 67 85 94 79 79 92 56 82 82 74 89 81 81 96 79 90 79

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!