Public Class Form1
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 Class kubus
Public Rusuk As Single
Public Function Volume_kubus() As Double
Return Rusuk * Rusuk * Rusuk
End Function
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objtabung As New tabung
With objtabung
.Tinggi = TextBox1.Text
.jari_jari = TextBox2.Text
TextBox3.Text = .Volume_tabung
End With
Dim objkubus As New kubus
With objkubus
.Rusuk = TextBox4.Text
TextBox5.Text = .Volume_kubus
End With
TextBox6.Text = TextBox5.Text - TextBox3.Text
End Sub
End Class
Komentar
Posting Komentar