Imports System
Module Test
Sub Main()
Console.WriteLine("Enter Operation to Perform")
PerformOp(New MathOperation(AddressOf Math.Sin))
PerformOp(New MathOperation(AddressOf Math.Cos))
PerformOp(New MathOperation(AddressOf Math.Tan))
End Sub
Delegate Function MathOperation(ByVal radians As Double) As Double
Private Sub PerformOp(ByVal op As MathOperation)
Dim angle As Double = 12
Dim radians As Double
radians = (angle / 360) * 2 * Math.PI
Dim result As Double
result = op.Invoke(radians)
result = Math.Round(result, 4)
Console.Writeline("Result = " & result.ToString())
End Sub
End Module
|