Module Tester
Sub Main()
Dim random As Random = New Random()
Dim circle As MyConstant = New MyConstant(random.Next(1, 20))
Dim radius As String = Convert.ToString(circle.RADIUS)
Console.WriteLine("Radius = " & radius & vbCrLf _
& "Circumference = " + String.Format("{0:N3}", _
circle.RADIUS * 2 * MyConstant.PI))
End Sub
End Module
Class MyConstant
Public Const PI As Double = 3.14159
Public ReadOnly RADIUS As Integer
Public Sub New(ByVal radiusValue As Integer)
RADIUS = radiusValue
End Sub
End Class
|