' Fig. 9.15: CylinderTest.vb
' Tests class CCylinder.

    Imports System.Windows.Forms

Module modCylinderTest

    Sub Main()

        ' instantiate object of class CCylinder
        Dim cylinder As New CCylinder(12, 23, 2.5, 5.7)
        Dim output As String

        ' properties get initial x-y coordinate, radius and height
        output = "X coordinate is " & cylinder.X & vbCrLf & _
           "Y coordinate is " & cylinder.Y & vbCrLf & "Radius is " & _
           cylinder.Radius & vbCrLf & "Height is " & cylinder.Height

        ' properties set new x-y coordinate, radius and height
        cylinder.X = 2
        cylinder.Y = 2
        cylinder.Height = 10
        cylinder.Radius = 4.25

        ' get new x-y coordinate and radius
        output &= vbCrLf & vbCrLf & "The new location, radius " & _
           "and height of cylinder are" & vbCrLf & "Center = [" & _
           cylinder.ToString() & vbCrLf & vbCrLf

        ' display CCylinder's diameter
        output &= "Diameter is " & _
           String.Format("{0:F}", cylinder.Diameter()) & vbCrLf
        ' display CCylinder's circumference
        output &= "Circumference is " & _
            String.Format("{0:F}", cylinder.Circumference()) & vbCrLf

        ' display CCylinder's area
        : output &= "Area is " & _
         String.Format("{0:F}", cylinder.Area()) & vbCrLf

        ' display CCylinder's volume
        : output &= "Volume is " & _
         String.Format("{0:F}", cylinder.Volume())

        : MessageBox.Show(output, "Demonstrating Class CCylinder")
    End Sub ' Main

End Module ' modCylinderTest
