I am looking to create a GUI grading program. I need to be able to read data from a file and get the averages and letter grade for each student. So far I am stumped here is my code so far:
CODE
import javax.swing.*;
import java.awt.*;
import java.util.Scanner;
import java.io.*;
public class Grading extends JFrame
{
private JList studentList;
private JLabel Avg;
private JLabel letter;
class studentGrades
{
public double Midterm;
public double Final;
public double Assignment1, Assignment2, Assignment3, Assignment4;
public void main() throws IOException
{
File grades = new File("Asg3Data.txt");
Scanner inputFile = new Scanner(grades);
inputFile.nextLine();
String Student1 = inputFile.nextLine();
String[] S1 = Student1.split("\\,");
String Student2 = inputFile.nextLine();
String[] S2 = Student2.split("\\,");
String Student3 = inputFile.nextLine();
String[] S3 = Student3.split("\\,");
String Student4 = inputFile.nextLine();
String[] S4 = Student4.split("\\,");
String Student5 = inputFile.nextLine();
String[] S5 = Student5.split("\\,");
String Student6 = inputFile.nextLine();
String[] S6 = Student6.split("\\,");
String Student7 = inputFile.nextLine();
String[] S7 = Student7.split("\\,");
String Student8 = inputFile.nextLine();
String[] S8 = Student8.split("\\,");
}
}
public static void main(String [] args)
{
}
}
Here is the content of the file i am reading from just in case:
LastName,FirstName, Exam1, Asg1, Asg2, Exam2, Asg3, Asg4
Christopher, Thomas, 78, 79, 82, 88, 78, 91
Cole, John, 100, 100, 100, 100, 100, 100
Karr, Arlen, 91, 86, 94, 100, 98, 93
McClurg, Andrew, 91, 87, 99, 87,,93
Noble, Rich, 84, 79, 85, 88, 90, 91
Rao, Sista, 91, 86, 94, 100, 98, 93
Stotz, Ralph, 81,83,,93, 78
Yi, Yu, 99, 88, 101, 76, 90, 94