Then write a program that reads the grades from the file and displays the number of scores in the
(1) A range (90-100)
(2) B range (80-89)
(3) C range (70-79)
(4) D range (60-69)
(5) F range (below 60)
Also list the highest score, lowest score, the average (mean) score and the percentage of the grades that fall above the average.
You must use a Do loop to read the file and count the number of grades.
You must use a case statement to count how many grades are in each range.
The number of grades should be stored as a variable and used in the calculation of the Average
High Score, Low score, Average and % above average must be figured out within the program.
1) You can not figure out the average until after you have read in all of the test scores.
2) After figuring out the average you must read the file in another loop to figure out how many are above average
3) For low score & High score you must compare the current score to the hig/low score so far. In order for this to work, High score must start out being the lowest score possible (0) and the variable for low score must start out being the highest score possible (100).
Do not use more than 2 loops.
i did most of the part..but still stuck with the loop
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEnd.Click MessageBox.Show("night") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClear.Click txtA.Clear() txtB.Clear() txtC.Clear() txtD.Clear() txtF.Clear() txtHs.Clear() txtls.Clear() txtAvearge.Clear() txtofGrades.Clear() End Sub Private Sub BtnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDisplay.Click Dim ACount As Integer Dim bcount As Integer Dim Ccount As Integer Dim dcount As Integer Dim fcount As Integer Dim i As Integer Dim grade(25) As Double Dim y As Integer Dim average As Double Dim Number(Me.txtAvearge.Item.Count - 1) As Double Dim lowergrade, highergrade As Double Dim newarray As String For y = 0 To (Me.txtAvearge.item.count - 1) Number(y) = CDbl(display.Items.Item(y)) Next y Array.Sort(Number) For y = 0 To y newarray = newarray & Convert.ToString(Number(y) & "") Next y lowergrade = Number(0) highergrade = Number(Number.Length - 1) Dim sr As IO.StreamReader = IO.File.OpenText("C:\Users\Stephen Ficarola\Desktop\LabPrjct5\LabPrjct5\final.txt") Do Until sr.Peek = -1 grade(i) = sr.ReadLine If grade(i) >= 90 Then ACount = ACount + 1 ElseIf grade(i) >= 80 Then bcount = bcount + 1 ElseIf grade(i) >= 70 Then Ccount = Ccount + 1 ElseIf grade(i) >= 60 Then dcount = dcount + 1 ElseIf grade(i) <= 59 Then fcount = fcount + 1 End If Loop sr.Close() For i As Integer = 0 To grade.GetUpperBound(0) Next End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Classthx in advance...
New Text Document (3).txt (2.19K)
Number of downloads: 280