Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to calculate average from a 2-D array text file?

$
0
0

Hello, I have this homework question

Q1

  1. Write an application to calculate student grades for a group project.
  2. Create a text file to store names of 5 students, line by line.
  3.  In a separate file enter peer evaluations from 0 to 1.0.
  4. Enter these numbers for evals:

1.0,  0.8,  0.9,  1.0,   0.6

0.2,  0.9,   0.5,   0.6,   0.7

0.5,  1.0,   1.0,  1.5,  0.9

0.9,  0.9,   0.9,    1.0,   1.0

1.0,  0.9,  1.0 ,   0.8,   0.9

This means that student 1 gave 1.0 eval for him- herself, 0.8 for student 2, 0.9 for student 3 etc. Student 2 gave 0.2 for student 1, 0.9 for him- herself, 0.5 for student 3 etc.

Read these into a 2-dimensional array.

If any of the values is greater than 1.0, set them to 1.0.

The program should calculate the average eval for a student.

While doing so, the program should ignore evals that student gave to him-herself.

Populate a list box with student names when the form loads.

The user should enter a project grade (same for everyone) in  a textbox.

 Then the user can select a student from a list and click “Calculate” button.

 The program should display the project grade for that student by multiplying average eval by the grade for the whole group (project grade).

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

thats what i did so far.

 private void Form1_Load(object sender, EventArgs e)
        {
            //read namesFile and show it on listbox
            StreamReader namesFile;
            namesFile = File.OpenText("Names.txt");
            while (!namesFile.EndOfStream)
            {
                studentsNamesListBox.Items.Add(namesFile.ReadLine());
            }

after this step i am not sure how to match the 2-d array file with the selected names in the list box.

can someone give me some direction? 



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>