Soal Kuis Pak Mesraan

Postingan Jawaban No 3 (Irsyahdi dalimunte)

Untuk kasus Klik Link Di Bawah Ini

http://mesran.wordpress.com/2012/01/26/kasus-program-tagihan-pdam/

Listing Program

Public Class Login

Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click
If user.Text = “sadi dalimunte” And pas.Text = “medan1987” Then
Menu_Utama.Show()
Me.Hide()
Else
MsgBox(“Data Yg Anda Masukan Salah !!!! Silahkan Anda Coba Lagi”)
user.Text = “”
pas.Text = “”

End If
End Sub

Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Dim i As Integer
i = MsgBox(” Apakah Anda Ingin Keluar dari Program ini”, MsgBoxStyle.YesNo, ” Kembali Ke Menu Utama”)
If  i = vbYes Then
End

End If
End Sub
End Class

hasil Program

 

Listing Program Menu Utama

 

Public Class Menu_Utama

Private Sub TagihanPDAMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TagihanPDAMToolStripMenuItem.Click
Tagihan_PDAM.MdiParent = Me
Tagihan_PDAM.Show()
End Sub

Private Sub KeluarProgramToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarProgramToolStripMenuItem.Click
Dim i As String
i = MsgBox(“Apakah Anda Ingin Keluar Dari Program ini”, MsgBoxStyle.YesNo, “Kembali Ke menu utama”)
If  i = vbYes Then
End

End If
End Sub
End Class

 

hasil Program

 

 

 

Listing Program Tagihan PDAM

 

Public Class Tagihan_PDAM

Sub table()
ListView1.Columns.Add(“K.Pelanggan”, 80, HorizontalAlignment.Center)
ListView1.Columns.Add(“Daerah”, 80, HorizontalAlignment.Center)
ListView1.Columns.Add(“T.Pelanggan”, 80, HorizontalAlignment.Center)
ListView1.Columns.Add(“N.Urut”, 80, HorizontalAlignment.Center)
ListView1.Columns.Add(“B.Beban”, 80, HorizontalAlignment.Center)
ListView1.Columns.Add(“J.pemakaain”, 80, HorizontalAlignment.Center)
ListView1.Columns.Add(“Harga”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“T.tagihan”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Pajak”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Pembayaran”, 80, HorizontalAlignment.Left)
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.FullRowSelect = True
End Sub
Sub isi()
Dim lst As New ListViewItem
lst.Text = kode.Text
lst.SubItems.Add(daerah.Text)
lst.SubItems.Add(plgn.Text)
lst.SubItems.Add(no.Text)
lst.SubItems.Add(biaya.Text)
lst.SubItems.Add(jmlh.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(tagihann.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(pembayaran.Text)
ListView1.Items.Add(lst)
End Sub

Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Dim i As String
i = Microsoft.VisualBasic.Left(kode.Text, 3)
If i = “TOK” Then
plgn.Text = “Toko”
biaya.Text = 25000
harga.Text = 300
ElseIf i = “RUM” Then
plgn.Text = “Rumah”
biaya.Text = 15000
harga.Text = 100
ElseIf i = “SWA” Then
plgn.Text = “swalayan”
biaya.Text = 10000
harga.Text = 200
ElseIf i = “PAB” Then
plgn.Text = “pabrik”
biaya.Text = 250000
harga.Text = 500
End If
i = Microsoft.VisualBasic.Mid(kode.Text, 5, 3)
If i = “MED” Then
daerah.Text = “medan”
ElseIf i = “BEL” Then
daerah.Text = “Belawan”
ElseIf i = “MAR” Then
daerah.Text = “marendal”
ElseIf i = “BIN” Then
daerah.Text = “binjai”
ElseIf i = “PAK” Then
daerah.Text = “lubukpakam”
ElseIf i = “TEM” Then
daerah.Text = “Akasara”

End If
no.Text = Microsoft.VisualBasic.Right(kode.Text, 3)
End Sub

Sub AddJumlah()
For i = 1 To 100
jmlh.Items.Add(i)
Next
End Sub

Private Sub Tagihan_PDAM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddJumlah()
table()

kode.Items.Add(“TOK-MED-100”)
kode.Items.Add(“TOK-BEL-101”)
kode.Items.Add(“TOK-TEM-102”)
kode.Items.Add(“TOK-MAR-103”)
kode.Items.Add(“TOK-BIN-104”)
kode.Items.Add(“TOK-PAK-105”)
kode.Items.Add(“RUM-MED-106”)
kode.Items.Add(“RUM-BEL-107”)
kode.Items.Add(“RUM-TEM-108”)
kode.Items.Add(“RUM-MAR-109”)
kode.Items.Add(“RUM-BIN-110”)
kode.Items.Add(“RUM-PAK-111”)
kode.Items.Add(“SWA-MED-112”)
kode.Items.Add(“SWA-BEL-113”)
kode.Items.Add(“SWA-TEM-114”)
kode.Items.Add(“SWA-MAR-115”)
kode.Items.Add(“SWA-BIN-116”)
kode.Items.Add(“SWA-PAK-117”)
kode.Items.Add(“PAB-MED-118”)
kode.Items.Add(“PAB-BEL-119”)
kode.Items.Add(“PAB-TEM-120”)
kode.Items.Add(“PAB-MAR-121”)
kode.Items.Add(“PAB-BIN-122”)
kode.Items.Add(“PAB-PAK-123”)

End Sub

Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
isi()
kode.Text = “”
daerah.Text = “”
plgn.Text = “”
no.Text = “”
biaya.Text = “”
harga.Text = “”
jmlh.Text = “”
pajak.Text = “”
tagihann.Text = “”
pembayaran.Text = “”
End Sub

Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
ListView1.Items.Remove(ListView1.SelectedItems(0))
End Sub

Private Sub hapuss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapuss.Click
ListView1.Items.Clear()
End Sub

Private Sub hitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hitung.Click
tagihann.Text = biaya.Text + harga.Text * jmlh.Text
pajak.Text = 0.1 * tagihann.Text
pembayaran.Text = Val(tagihann.Text) + Val(pajak.Text)

 

End Sub
End Class

 

 

Hasil Program

 

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: