1 Replies - 7788 Views - Last Post: 20 May 2010 - 02:47 AM Rate Topic: -----

#1 d3vil112  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 2
  • Joined: 14-May 10

final exam grade statistic

Posted 14 May 2010 - 09:23 PM

Create a text file, “Final.txt” that contains 25 student grades on a final exam:

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

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClear.Click

    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
        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

        For i As Integer = 0 To grade.GetUpperBound(0)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
thx in advance...

Attached File(s)

Is This A Good Question/Topic? -1
  • +

Replies To: final exam grade statistic

#2 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 293
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: final exam grade statistic

Posted 20 May 2010 - 02:47 AM


can you explain why you want to do this?

 For y = 0 To y

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1