Question: You are to write a program to grade multiple - choice exam. The exam has 2 0 questions, each answered with a number in the

You are to write a program to grade multiple-choice exam. The exam has 20 questions, each answered with a number in the range of 1 to 4. The data are stored on a file (exams.txt) where the first line is the key, consisting of a string of 20 digits. Then each line consists of student name and the exam answers.
Benson, 12341234123412341231
Gause, 12341224123412341244
King, 12341233123412141244
Savon, 22341334123412341235
this what i have so far
Public Class Form1
Dim names() As String
Dim Answers() As String
Dim key As String ="12341234123412341234"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim temp() As String = IO.File.ReadAllLines("scores.txt")
ReDim names(temp.Count -1)
ReDim Answers(temp.Count -1)
Dim input(1) As String
' read the input data into the names() and answers() array
For i As Integer =0 To temp.Count -1
input = temp(i).Split(","c)
names(i)= input(0)
Answers(i)= CDbl(input(1))
Next
End Sub
Private Sub btnResults_Click(sender As Object, e As EventArgs) Handles btnResults.Click
Dim min =100
Dim max =0
Dim total =0
For i =0 To names.Count -1
Dim score As Integer =0
Dim answer As String = Answers(i)
For j =0 To key.Length -1
If key(j)= answer(j) Then
score +=1
End If
Next
lstOutput.Items.Add(names(i) & ": " & score)
total += score
'Get the grades and show each students grade
'Get the max and min
Next
'Show the max, min, and average
End Sub
End Class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!