Free Open Sorce VB.net Menghitung Volume Lingkaran dan Tabung

Source Kode Freeware Menghitung Volume Lingkaran dan Tabung menggunakan VB.net 2005 sebagai bahan pembelajaran berikut SccreenShoot dan source Code.
Public Class lingkaran
    Public jari_jari As Single
    Const phi = 3.14
    Public Class tabung
        Public tinggi As Single
        Public jari_jari As Single
        Const phi = 3.14
        Public Function volume_tabung() As Double
            Return phi * jari_jari * jari_jari * tinggi
        End Function
    End Class
    Public Function luas_lingkaran() As Double
        Return phi * jari_jari * jari_jari
    End Function
    Public Function keliling_lingkaran() As Double
        Return 2 * phi * jari_jari
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ojecklingkaran As New lingkaran
        With ojecklingkaran
            .jari_jari = TextBox1.Text
            Label4.Text = .luas_lingkaran()
            Label5.Text = .keliling_lingkaran()
        End With
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim tabung As New tabung
        With tabung
            .tinggi = TextBox2.Text
            .jari_jari = TextBox3.Text
            Label8.Text = .volume_tabung
        End With
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        Label4.Text = ""
        Label5.Text = ""
        Label8.Text = ""
    End Sub

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

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        hitungsegitiga.Show()
    End Sub

End Class

No comments:

Post a Comment