Public Class frmIceCream
    ' 6598765865876
    Private Sub btnEnterData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterData.Click
        ' This program Calculates the Average
        Dim Icecream As Single
        Dim Colddrinks As Single
        Dim Average As Single

        Icecream = txtIceCream.Text
        Colddrinks = txtColdDrinks.Text

        If Icecream > 0 Or Colddrinks > 0 Then
            Average = CalcAverage(Icecream, Colddrinks)
            lblAnswer.Text = " The average = " & Format(Average, "C").ToString
        Else
            lblAnswer.Text = " Values Entered is below 1"
        End If
        txtIceCream.Clear()
        txtColdDrinks.Clear()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Public Function CalcAverage(ByVal IceCream As Single, ByVal Colddrinks As Single) As Single
        Dim myaverage As Single
        myaverage = (IceCream + Colddrinks) / 2
        Return myaverage
    End Function

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtIceCream.Clear()
        txtColdDrinks.Clear()
        lblAnswer.Text = ""
    End Sub
End Class
