Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an application that reads a file called Test Scores.txt with 11 scores. P

ID: 658180 • Letter: C

Question

Create an application that reads a file called Test Scores.txt with 11 scores. Place the data in an array or list and display the content of the array or list in a listbox.

Calculate the lowest score, highest score, median score, average score and the standard deviation of the scores. Display those values.

Write methods that accept an array or list and returns lowest score, highest score, median score, average score and the standard deviation of the scores.

Note: the median is calculated differently if your data is odd or even. Ensure that your method can handle an even or odd number of data items.

Explanation / Answer

Imports System.IO

Public Class Form1
Public a(11) As Integer

Private Sub max()
Dim l As Integer = a(0)
For i = 0 To 11
If a(i) > l Then
l = a(i)
End If

Next
TextBox2.Text = l


End Sub

Private Sub min()
Dim s As Integer = a(0)
For i = 0 To 11
If a(i) < s Then
s = a(i)
End If

Next
TextBox1.Text = s


End Sub

Private Sub av()
Dim s As Integer = 0
For i = 0 To 11

s = s + a(i)


Next
TextBox1.Text = s / 11


End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Using sr As New StreamReader("Scores.txt")
Dim i As Integer = 0

Dim line As String
line = sr.ReadToEnd()
ListBox1.Items.Add(line)
a(i) = line
i = i + 1
End Using
Catch e As Exception
Console.WriteLine("The file could not be read:")
Console.WriteLine(e.Message)
End Try
max()
min()
av()
End Sub
End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote