JAVA grading program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomshorts07
    New Member
    • Apr 2008
    • 9

    #1

    JAVA grading program

    hey everyone, i'm new to JAVA, and i'm trying to make a program that takes a .txt file with the format

    10 4 2 2 3 1 5 4 2 4 4
    Joe, 4 4 1 3 2 5 4 2 4 3
    Mary, 4 2 2 3 2 5 3 2 4 4
    Fred, 3 2 2 3 1 5 4 2 4 4

    ***(the first line is the 'answer key'; the first number indicates the total number of answers, and the numbers that follow are the 'correct' answers.
    the lines following the 'answer key' are the students answers.)***

    the program that i am trying to make involves using arrays to compare the 'answer key' to the students answers, and then return a statement along the lines of

    Joe, 60%
    Mary, 80%
    Fred, 90%

    i need to use an array for the answer key and the comparisons, because the number of questions change frequently

    any help with this project would be GREATLY appreciated
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

    Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

    Then when you are ready post a new question in this thread.

    MODERATOR

    Comment

    • tomshorts07
      New Member
      • Apr 2008
      • 9

      #3
      i understand-
      the main problem that i am having with the program is the java.io.* functions?

      i cant figure out how to compose the code to make the program read the file and create the array

      im sorry, i should have specified this in the first post

      if anyone can help me figure out just simply how to create the arrays from the .txt file, i should be fine from there!

      THANKS A TON!

      Comment

      • sukatoa
        Contributor
        • Nov 2007
        • 539

        #4
        Originally posted by tomshorts07
        i understand-
        the main problem that i am having with the program is the java.io.* functions?

        i cant figure out how to compose the code to make the program read the file and create the array

        im sorry, i should have specified this in the first post

        if anyone can help me figure out just simply how to create the arrays from the .txt file, i should be fine from there!

        THANKS A TON!
        Well, you could start to Read Scanner class....

        if test.txt has a content "1 2 3 4 5"..

        Here is the example,

        Code:
        int x = 0;
        		String array[] = new String[6];
        		Scanner scan = new Scanner(new File("test.txt"));
        		while(scan.hasNext()){
        			array[x] = scan.next();
        			x++;
        		}scan.close();
        After some experiments on it, Have a look at FileReader.....

        regards,
        sukatoa

        Comment

        Working...