2 Replies - 1042 Views - Last Post: 13 October 2008 - 11:55 PM Rate Topic: -----

#1 genuinek  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-October 08

Grading program

Posted 13 October 2008 - 11:01 PM

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:

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

Is This A Good Question/Topic? 0
  • +

Replies To: Grading program

#2 AmitTheInfinity  Icon User is offline

  • C Surfing ∞
  • member icon

Reputation: 117
  • View blog
  • Posts: 1,559
  • Joined: 25-January 07

Re: Grading program

Posted 13 October 2008 - 11:51 PM

Two main functions in one class? :blink:
Was This Post Helpful? 0
  • +
  • -

#3 genuinek  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-October 08

Re: Grading program

Posted 13 October 2008 - 11:55 PM

Should I just leave the file input and split methods in the public static void main function.

This post has been edited by genuinek: 13 October 2008 - 11:56 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1