Index of Projects [back] RealBasic Source Code - Find That Average

Window1.Average:
Function Average(a As integer, b As integer, c As integer) As double
   Dim d as double
   d = (a + b + c) / 3
   Return d
End Function

Window1.PrintToScreen:
Sub PrintToScreen(answer As String)
   txtAverage.text=answer
End Sub

Window1.btnAverage.Action:
Sub Action()
   Dim a, b, c as Integer
   Dim d as Double
   Dim answer as string
   a = Val(edtEntry1.text)
   b = Val(edtEntry2.text)
   c = Val(edtEntry3.text)
   d = Average (a, b, c)
   answer=Format(d, "#.00")
   PrintToScreen(answer)
End Sub

Window1.btnQuit.Actio
Sub Action()
   Quit
End Sub

Window1.btnClear.Action:
Sub Action()
   edtEntry1.text=""
   edtEntry2.text=""
   edtEntry3.text=""
   txtAverage.text=""
End Sub 1