Please, provide a clear and detailed answer: Create an application that reads a
ID: 655932 • Letter: P
Question
Please, provide a clear and detailed answer:
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
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As StreamReader
Dim str As String
Dim a(10) As Integer
Dim l, s, i, sum As Integer
sum = 0
obj = New StreamReader("C:scores.txt")
l = 0
s = 0
For i = 0 To 10
a(i) = Convert.ToInt32(obj.ReadLine)
sum = sum + a(i)
If l > a(i) Then
l = a(i)
End If
If s < a(i) Then
s = a(i)
End If
Next
TextBox1.Text = s
TextBox2.Text = l
TextBox3.Text = sum / 11
obj.Close()
End Sub
End Class