Judul Soal
Jawaban Program:
gambar Contoh Program Tagihan Listrik dan jika ingin sintax programnya sebagai berikut:
Public Class btn_besar_pakai
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
daerah.Items.Add("MED")
daerah.Items.Add("BEL")
daerah.Items.Add("TEM")
daerah.Items.Add("PAK")
daerah.Items.Add("MAR")
daerah.Items.Add("BIN")
Tipe_pelanggan.Items.Add("TOK")
Tipe_pelanggan.Items.Add("RUM")
Tipe_pelanggan.Items.Add("SWA")
Tipe_pelanggan.Items.Add("PAB")
End Sub
Sub BuatTabel()
LV.Columns.Add("ID PELANGGAN", 80, HorizontalAlignment.Center)
LV.Columns.Add("NAMA", 180, HorizontalAlignment.Left)
lv.Columns.Add("DAERAH", 80, HorizontalAlignment.Center)
lv.Columns.Add("TIPE PELANGGAN", 80, HorizontalAlignment.Center)
lv.Columns.Add("BIAYA BEBAN", 180, HorizontalAlignment.Left)
lv.Columns.Add("HARGA PER KWH", 180, HorizontalAlignment.Left)
lv.Columns.Add("METER BULAN INI", 180, HorizontalAlignment.Left)
lv.Columns.Add("METER BULAN LALU", 180, HorizontalAlignment.Left)
lv.Columns.Add("BESAR PEMAKAIAN", 180, HorizontalAlignment.Left)
lv.Columns.Add("BESAR TAGIHAN", 180, HorizontalAlignment.Left)
lv.Columns.Add("BESAR PAJAK ", 180, HorizontalAlignment.Left)
lv.Columns.Add("TOTAL PEMBAYARAN", 180, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub IsiTabel()
Dim lst As New ListViewItem
lst.Text = id_pelanggan.Text
lst.SubItems.Add(nama.Text)
lst.SubItems.Add(daerah.Text)
lst.SubItems.Add(Tipe_pelanggan.Text)
lst.SubItems.Add(biaya_beban.Text)
lst.SubItems.Add(harga_kwh.Text)
lst.SubItems.Add(meter_bulan_awal.Text)
lst.SubItems.Add(meter_bulan_lalu.Text)
lst.SubItems.Add(besar_pemakaian.Text)
lst.SubItems.Add(tagihan.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(pembayaran.Text)
lv.Items.Add(lst)
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
IsiTabel()
id_pelanggan.Text = " "
nama.Text = " "
End Sub
Private Sub daerah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles daerah.SelectedIndexChanged
End Sub
Private Sub Tipe_pelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tipe_pelanggan.SelectedIndexChanged
If Tipe_pelanggan.Text = "TOK" Then
biaya_beban.Text = 150000
harga_kwh.Text = 500
ElseIf Tipe_pelanggan.Text = "RUM" Then
biaya_beban.Text = 50000
harga_kwh.Text = 200
ElseIf Tipe_pelanggan.Text = "SWA" Then
biaya_beban.Text = 400000
harga_kwh.Text = 1500
ElseIf Tipe_pelanggan.Text = "PAB" Then
biaya_beban.Text = 1000000
harga_kwh.Text = 10000
End If
End Sub
Private Sub tagihan_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tagihan.TextChanged
tagihan.Text = biaya_beban.Text + harga_kwh.Text * besar_pemakaian.text
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
besar_pemakaian.Text = meter_bulan_awal.Text - meter_bulan_lalu.Text
End Sub
Private Sub btn_tagihan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_tagihan.Click
tagihan.Text = biaya_beban.Text + harga_kwh.Text * besar_pemakaian.Text
End Sub
Private Sub btn_pajak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_pajak.Click
pajak.Text = 0.015 * tagihan.Text
End Sub
Private Sub Bayar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bayar.Click
pembayaran.Text = tagihan.Text + pajak.Text
End Sub
End Class
Demikianlah Postingan Saya
Nama : Firman Zalukhu
Npm : 1111586
Selamat Pemrograman VB NET
Jawaban Program:
gambar Contoh Program Tagihan Listrik dan jika ingin sintax programnya sebagai berikut:
Public Class btn_besar_pakai
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
daerah.Items.Add("MED")
daerah.Items.Add("BEL")
daerah.Items.Add("TEM")
daerah.Items.Add("PAK")
daerah.Items.Add("MAR")
daerah.Items.Add("BIN")
Tipe_pelanggan.Items.Add("TOK")
Tipe_pelanggan.Items.Add("RUM")
Tipe_pelanggan.Items.Add("SWA")
Tipe_pelanggan.Items.Add("PAB")
End Sub
Sub BuatTabel()
LV.Columns.Add("ID PELANGGAN", 80, HorizontalAlignment.Center)
LV.Columns.Add("NAMA", 180, HorizontalAlignment.Left)
lv.Columns.Add("DAERAH", 80, HorizontalAlignment.Center)
lv.Columns.Add("TIPE PELANGGAN", 80, HorizontalAlignment.Center)
lv.Columns.Add("BIAYA BEBAN", 180, HorizontalAlignment.Left)
lv.Columns.Add("HARGA PER KWH", 180, HorizontalAlignment.Left)
lv.Columns.Add("METER BULAN INI", 180, HorizontalAlignment.Left)
lv.Columns.Add("METER BULAN LALU", 180, HorizontalAlignment.Left)
lv.Columns.Add("BESAR PEMAKAIAN", 180, HorizontalAlignment.Left)
lv.Columns.Add("BESAR TAGIHAN", 180, HorizontalAlignment.Left)
lv.Columns.Add("BESAR PAJAK ", 180, HorizontalAlignment.Left)
lv.Columns.Add("TOTAL PEMBAYARAN", 180, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub IsiTabel()
Dim lst As New ListViewItem
lst.Text = id_pelanggan.Text
lst.SubItems.Add(nama.Text)
lst.SubItems.Add(daerah.Text)
lst.SubItems.Add(Tipe_pelanggan.Text)
lst.SubItems.Add(biaya_beban.Text)
lst.SubItems.Add(harga_kwh.Text)
lst.SubItems.Add(meter_bulan_awal.Text)
lst.SubItems.Add(meter_bulan_lalu.Text)
lst.SubItems.Add(besar_pemakaian.Text)
lst.SubItems.Add(tagihan.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(pembayaran.Text)
lv.Items.Add(lst)
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
IsiTabel()
id_pelanggan.Text = " "
nama.Text = " "
End Sub
Private Sub daerah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles daerah.SelectedIndexChanged
End Sub
Private Sub Tipe_pelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tipe_pelanggan.SelectedIndexChanged
If Tipe_pelanggan.Text = "TOK" Then
biaya_beban.Text = 150000
harga_kwh.Text = 500
ElseIf Tipe_pelanggan.Text = "RUM" Then
biaya_beban.Text = 50000
harga_kwh.Text = 200
ElseIf Tipe_pelanggan.Text = "SWA" Then
biaya_beban.Text = 400000
harga_kwh.Text = 1500
ElseIf Tipe_pelanggan.Text = "PAB" Then
biaya_beban.Text = 1000000
harga_kwh.Text = 10000
End If
End Sub
Private Sub tagihan_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tagihan.TextChanged
tagihan.Text = biaya_beban.Text + harga_kwh.Text * besar_pemakaian.text
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
besar_pemakaian.Text = meter_bulan_awal.Text - meter_bulan_lalu.Text
End Sub
Private Sub btn_tagihan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_tagihan.Click
tagihan.Text = biaya_beban.Text + harga_kwh.Text * besar_pemakaian.Text
End Sub
Private Sub btn_pajak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_pajak.Click
pajak.Text = 0.015 * tagihan.Text
End Sub
Private Sub Bayar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bayar.Click
pembayaran.Text = tagihan.Text + pajak.Text
End Sub
End Class
Demikianlah Postingan Saya
Nama : Firman Zalukhu
Npm : 1111586
Selamat Pemrograman VB NET
Tidak ada komentar:
Posting Komentar