Public Class frmProps_Methods

  Private Sub btnDisplay_Click(ByVal sender As System.Object,
                               ByVal e As System.EventArgs) Handles btnDisplay.Click
    Dim ages(43) As Integer
    Dim temp() As String = IO.File.ReadAllLines("AgesAtInaugural.txt")
    For i As Integer = 0 To 43
      ages(i) = CInt(temp(i))
    Next
    lstValues.Items.Add("Obama: " & ages(ages.Count - 1))
    lstValues.Items.Add("Washington: " & ages.First)
    lstValues.Items.Add("Obama: " & ages.Last)
    lstValues.Items.Add("Oldest age: " & ages.Max)
    lstValues.Items.Add("Youngest age: " & ages.Min)
    lstValues.Items.Add("Average age: " & FormatNumber(ages.Average))
    lstValues.Items.Add("Average age: " & FormatNumber(ages.Sum / ages.Count))
  End Sub

End Class
