' Written on Wednesday, June 24th for 810:030 class...

Function heightToInches(feetInches As String) As Integer
    inches = 12 * Val(Left(feetInches, 1)) + _
             Val(Mid(feetInches, 3))
    heightToInches = inches
End Function

Private Sub cmdReadFile_Click()
    Dim playersHeights(16) As String, playerHeight As String
    
    Open "Z:\web\UNIplayers.txt" For Input As #10
    
    numberOfPlayers = 0
    totalInches = 0
    
    Print
    Form1.ForeColor = RGB(255, 0, 255)
    
    Do Until EOF(10)
        Input #10, playerNumber, playerName, playerHeight
        
        playersHeights(numberOfPlayers) = playerHeight
        
        numberOfPlayers = numberOfPlayers + 1
        totalInches = totalInches + heightToInches(playerHeight)
        
        Print IIf(playerNumber < 10, " ", "") & playerNumber & _
              " is " & playerName
    Loop
    
    Form1.ForeColor = vbBrown
    
    Print vbCrLf; "There are "; numberOfPlayers & _
                   " UNI VB players."
    
    averageHeight = totalInches / numberOfPlayers
    feet = averageHeight \ 12
    inches = averageHeight Mod 12
    
    Print vbCrLf & _
          "Average height: " & _
          feet & "-" & _
          Format(inches, "##") & _
          " or " & Format(averageHeight, "##.#") & _
          " inches."
    Close #10
End Sub