Berikut Jawaban Program
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add("MB1")
kode.Items.Add("MB2")
kode.Items.Add("MB3")
kode.Items.Add("MB4")
tahun.Items.Add("2012")
tahun.Items.Add("2013")
tahun.Items.Add("2014")
kondisi.Items.Add("Baru")
kondisi.Items.Add("Bekas")
jb.Items.Add("1")
jb.Items.Add("2")
jb.Items.Add("3")
lama.Items.Add("12")
lama.Items.Add("24")
lama.Items.Add("36")
Call rancangtabel()
End Sub
Sub rancangtabel()
lv.Columns.Add("Kode", 40, HorizontalAlignment.Left)
lv.Columns.Add("Nama", 80, HorizontalAlignment.Left)
lv.Columns.Add("Tahun", 80, HorizontalAlignment.Left)
lv.Columns.Add("Kondisi", 80, HorizontalAlignment.Left)
lv.Columns.Add("Harga", 100, HorizontalAlignment.Left)
lv.GridLines = True
lv.View = View.Details
lv.FullRowSelect = True
End Sub
Sub isitabel()
Dim mobil As New ListViewItem
mobil.Text = kode.Text
mobil.SubItems.Add(nama.Text)
mobil.SubItems.Add(tahun.Text)
mobil.SubItems.Add(kondisi.Text)
mobil.SubItems.Add(Harga.Text)
lv.Items.Add(mobil)
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
If kode.Text = "MB1" Then
nama.Text = "Avanza Veloz"
ElseIf kode.Text = "MB2" Then
nama.Text = "Avanza G"
ElseIf kode.Text = "MB3" Then
nama.Text = "Xenia"
ElseIf kode.Text = "MB4" Then
nama.Text = "Toyota Yaris"
End If
End Sub
Private Sub kondisi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kondisi.SelectedIndexChanged
If kode.Text = "MB1" And nama.Text = "Avanza Veloz" And kondisi.Text = "Baru" And tahun.Text = "2012" Then
Harga.Text = "175000000"
ElseIf kode.Text = "MB1" And nama.Text = "Avanza Veloz" And kondisi.Text = "Bekas" And tahun.Text = "2012" Then
Harga.Text = "130000000"
ElseIf kode.Text = "MB1" And nama.Text = "Avanza Veloz" And kondisi.Text = "Baru" And tahun.Text = "2013" Then
Harga.Text = "195000000"
ElseIf kode.Text = "MB1" And nama.Text = "Avanza Veloz" And kondisi.Text = "Bekas" And tahun.Text = "2013" Then
Harga.Text = "150000000"
ElseIf kode.Text = "MB1" And nama.Text = "Avanza Veloz" And kondisi.Text = "Baru" And tahun.Text = "2014" Then
Harga.Text = "208000000"
ElseIf kode.Text = "MB1" And nama.Text = "Avanza Veloz" And kondisi.Text = "Bekas" And tahun.Text = "2014" Then
Harga.Text = "160000000"
ElseIf kode.Text = "MB2" And nama.Text = "Avanza G" And kondisi.Text = "Baru" And tahun.Text = "2012" Then
Harga.Text = "160000000"
ElseIf kode.Text = "MB2" And nama.Text = "Avanza G" And kondisi.Text = "Bekas" And tahun.Text = "2012" Then
Harga.Text = "130000000"
ElseIf kode.Text = "MB2" And nama.Text = "Avanza G" And kondisi.Text = "Baru" And tahun.Text = "2013" Then
Harga.Text = "170000000"
ElseIf kode.Text = "MB2" And nama.Text = "Avanza G" And kondisi.Text = "Bekas" And tahun.Text = "2013" Then
Harga.Text = "140000000"
ElseIf kode.Text = "MB2" And nama.Text = "Avanza G" And kondisi.Text = "Baru" And tahun.Text = "2014" Then
Harga.Text = "180000000"
ElseIf kode.Text = "MB2" And nama.Text = "Avanza G" And kondisi.Text = "Bekas" And tahun.Text = "2014" Then
Harga.Text = "150000000"
ElseIf kode.Text = "MB3" And nama.Text = "Xenia" And kondisi.Text = "Baru" And tahun.Text = "2012" Then
Harga.Text = "165000000"
ElseIf kode.Text = "MB3" And nama.Text = "Xenia" And kondisi.Text = "Bekas" And tahun.Text = "2012" Then
Harga.Text = "125000000"
ElseIf kode.Text = "MB3" And nama.Text = "Xenia" And kondisi.Text = "Baru" And tahun.Text = "2013" Then
Harga.Text = "176000000"
ElseIf kode.Text = "MB3" And nama.Text = "Xenia" And kondisi.Text = "Bekas" And tahun.Text = "2013" Then
Harga.Text = "145000000"
ElseIf kode.Text = "MB3" And nama.Text = "Xenia" And kondisi.Text = "Baru" And tahun.Text = "2014" Then
Harga.Text = "190000000"
ElseIf kode.Text = "MB3" And nama.Text = "Xenia" And kondisi.Text = "Bekas" And tahun.Text = "2014" Then
Harga.Text = "155000000"
ElseIf kode.Text = "MB4" And nama.Text = "Toyota Yaris" And kondisi.Text = "Baru" And tahun.Text = "2012" Then
Harga.Text = "200000000"
ElseIf kode.Text = "MB4" And nama.Text = "Toyota Yaris" And kondisi.Text = "Bekas" And tahun.Text = "2012" Then
Harga.Text = "170000000"
ElseIf kode.Text = "MB4" And nama.Text = "Toyota Yaris" And kondisi.Text = "Baru" And tahun.Text = "2013" Then
Harga.Text = "230000000"
ElseIf kode.Text = "MB4" And nama.Text = "Toyota Yaris" And kondisi.Text = "Bekas" And tahun.Text = "2013" Then
Harga.Text = "180000000"
ElseIf kode.Text = "MB4" And nama.Text = "Toyota Yaris" And kondisi.Text = "Baru" And tahun.Text = "2014" Then
Harga.Text = "250000000"
ElseIf kode.Text = "MB4" And nama.Text = "Toyota Yaris" And kondisi.Text = "Bekas" And tahun.Text = "2014" Then
Harga.Text = "200000000"
End If
End Sub
Private Sub jb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jb.SelectedIndexChanged
totalharga.Text = Harga.Text * jb.Text
Uang.Text = 0.3 * Harga.Text
komisi.Text = 0.02 * jb.Text * Uang.Text
totalkredit.Text = totalharga.Text - Uang.Text
End Sub
Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
Call isitabel()
End Sub
Private Sub lama_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lama.SelectedIndexChanged
angsuran.Text = Val(totalkredit.Text) * 0.03 * lama.Text + Val(totalkredit.Text) / lama.Text
End Sub
Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
Me.Close()
End Sub
Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
kode.Text = ""
nama.Text = ""
tahun.Text = ""
kondisi.Text = ""
Harga.Text = ""
jb.Text = ""
Uang.Text = ""
totalharga.Text = ""
totalkredit.Text = ""
komisi.Text = ""
lama.Text = ""
angsuran.Text = ""
End Sub
End Class
Demikianlah Postingan Saya
Nama : Lia Ciky Lumban Gaol
Npm : 13110412
Selamat Melihat (Mesran.Net)