java & c++ help

edited March 2008 in Internet & Media
hi...i am just new to java &c++..can anyone give me some help with my program..
here is the question:
plz hlep me a little bit..give me some hint


Write a program to keep records and perform statistical analysis for a class of students. The class may have up to 40 students. There are five quizzes during the term. Each student is identified by a four-digit student ID number.
The program is to print the student scores and calculate and print the statistics for each quiz. The output is in the same order as the input; no sorting is needed. The input is to be read from a text file. The output from the program should be similar to the following -
Stud Q1 Q2 Q3 Q4 Q5
1234 78 83 87 91 86
2134 67 77 84 82 79
1852 77 89 93 87 71
High Score 78 89 93 91 86
Low Score 67 77 84 82 71
Average 73.4 83.0 88.2 86.6 78.6

Comments

  • CBCB Ƹ̵̡Ӝ̵̨̄Ʒ Der Millionendorf- Icrontian
    edited March 2008
    Welcome to Icrontic.

    Can you be more specific about what part you're having trouble with? Is there a reason your instructor cannot help you?
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2008
    also. are you supposed to write this in java or c++ ?
  • edited March 2008
    shwaip wrote:
    also. are you supposed to write this in java or c++ ?


    it should be java...the part i am confusing is that how to read from the file by using the method and then fill it in the array
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2008
    don't you have a book?
  • CBCB Ƹ̵̡Ӝ̵̨̄Ʒ Der Millionendorf- Icrontian
    edited March 2008
    sean123 wrote:
    the part i am confusing is that how to read from the file by using the method and then fill it in the array

    That sounds like the entire assignment. We're not going to do your homework for you.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2008
    You'll probably want to use BufferedReader and split().

    you can get file io help from the java doc here:
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

    check the javadoc for the String class - it will teach you how to use split()
  • jj Sterling Heights, MI Icrontian
    edited March 2008
    set up a 2 dimensional array such as arrayX[student#][Quiz#]. Then read you file till "end of file" and each time there is a new line character increment the student # count. then the next 4 are the quizzes so. To do this I would think you need two loops. One for students and one for quizzes such as, and forgive me but this is kinda C++. I'm not going to take the time to do the correct syntax, but I think it will give you an idea how to approach this problem

    sCount = 0
    qCount = 0
    read file
    while not end of file
    {
    arrayX[sCount][qCount]= get_int //read numbers till you see a space
    for qCount = 0 to 3
    {
    arrayX[sCount][qCount]= get_int //read numbers till you see a space
    qCount+1
    }
    sCount+1
    qCount = 0
    }
    //rest of code
Sign In or Register to comment.