Public Class Form1 '////// CSY112 L.Peacock - avg pgm '/// Global declarations. Dim many As Integer = 0 ' how many values. Dim total As Integer = 0 ' total (so far). Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '//// Accumulate numbers into a total '0. declarations, txt Dim nextvalue As Integer 'the next input # '1. Input Get # from TXT nextvalue = CInt(Me.TXT.Text) '2. process: Add n to total total = total + nextvalue many = many + 1 '3. output: display the total (so far). Me.oResults.Items.Add("The total (so far) is: " _ & Format(total)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bavg.Click '//// compute and display the average Dim avg As Double '1. input: global variables: total, many '2. Process: compute the average = total / many avg = total / many '3. output: display it. Me.oResults.Items.Clear() Me.oResults.Items.Add("The average is " & avg) End Sub End Class