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

I need help with this java project. Here is the Source code link for (TestScoreR

ID: 3913803 • Letter: I

Question

I need help with this java project. 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) source code: http://www.jade-cheng.com/hpu/2012-spring/csci-2912/text-processing-and-wrapper-classes-ii/TestAverages.java? 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) source code: http://www.jade-cheng.com/hpu/2012-spring/csci-2912/text-processing-and-wrapper-classes-ii/TestAverages.java?
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

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 TestAveragesjava 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

Explanation / Answer

First of all export csv file to mysql using command like:-

------------------------------------------------------------------------------------

mysql> create database students;

mysql> use students;

mysql> create table average(marks1 int,marks2 int,marks3 int,marks4 int,marks5 int,average int)

mysql> load data infile 'Grades.csv' into table average fields terminated by ',' lines terminated by ' ' (marks1,marks2,marks3,marks
4,marks5,avg int);

-------------------------------------------------------------------------------------------------------

I have created one java program to create database and to show marks and average of students.

-------------------------------------------------------------------------------------------------------------------

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
public class TestAverages
{
public static void main(String[] args)
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/students", "root","root"); //mysql connection
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("select * from average");
int count=0,n=1;
if (rs != null) // if rs == null, then there is no record
while ( rs.next() ) // By this line we will step through our data row-by-row
{
System.out.println("Marks for student:" +n );
System.out.println("marks1: " + rs.getInt(1) ); count++; //printing marks and count++ for calculating avg
System.out.println("marks2: " + rs.getInt(2) ); count++;
System.out.println("marks3: " + rs.getInt(3) ); count++;
System.out.println("marks4: " + rs.getInt(4) ); count++;
System.out.println("marks5: " + rs.getInt(5) ); count++;
System.out.println((rs.getFloat(1) + rs.getFloat(2) + rs.getFloat(3) + rs.getFloat(4)+ rs.getFloat(5))/count); //average printing
System.out.println("________________________________________" );
count=0;
n++;
}
  
s.close(); // close the Statement
con.close(); // close the Connection
}
catch (SQLException err)
{
System.out.println("ERROR: " + err);
}
catch (Exception err)
{
System.out.println("ERROR: " + err);
}
}
}

------------------------------------------------------------------------------------------------------------------------

After running this program will print the average marks of student...................

------------------------------------------------------------------------------------------------------------------------

Extra note:--: Add library MySQL JDBC Driver If com.mysql.jdbc.Driver exception raises.......