Berikut Jawaban Program:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call buattabel()
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")
tahun.Items.Add("2015")
kondisi.Items.Add("Baru")
kondisi.Items.Add("Bekas")
For i = 1 To 20
jumlah.Items.Add(i)
Next
For t = 12 To 48 Step 6
lamakredit.Items.Add(t)
Next
End Sub
Private Sub kode2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
If kode.Text = "MB1" Then
nm.Text = "AVANZA VELOZ"
ElseIf kode.Text = "MB2" Then
nm.Text = "AVANZA G"
ElseIf kode.Text = "MB3" Then
nm.Text = "VIOZ "
ElseIf kode.Text = "MB4" Then
nm.Text = "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 tahun.Text = "2012" And kondisi.Text = "Baru" Then
harga.Text = 175000000
ElseIf kode.Text = "MB1" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
harga.Text = 120000000
ElseIf kode.Text = "MB1" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
harga.Text = 195000000
ElseIf kode.Text = "MB1" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
harga.Text = 130000000
ElseIf kode.Text = "MB1" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
harga.Text = 208000000
ElseIf kode.Text = "MB1" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
harga.Text = 170000000
ElseIf kode.Text = "MB2" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
harga.Text = 175000000
ElseIf kode.Text = "MB2" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
harga.Text = 120000000
ElseIf kode.Text = "MB2" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
harga.Text = 195000000
ElseIf kode.Text = "MB2" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
harga.Text = 130000000
ElseIf kode.Text = "MB2" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
harga.Text = 208000000
ElseIf kode.Text = "MB2" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
harga.Text = 120000000
ElseIf kode.Text = "MB3" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
harga.Text = 175000000
ElseIf kode.Text = "MB3" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
harga.Text = 120000000
ElseIf kode.Text = "MB3" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
harga.Text = 195000000
ElseIf kode.Text = "MB3" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
harga.Text = 130000000
ElseIf kode.Text = "MB3" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
harga.Text = 208000000
ElseIf kode.Text = "MB3" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
harga.Text = 120000000
ElseIf kode.Text = "MB4" And tahun.Text = "2012" And kondisi.Text = "Baru" Then
harga.Text = 175000000
ElseIf kode.Text = "MB4" And tahun.Text = "2012" And kondisi.Text = "Bekas" Then
harga.Text = 120000000
ElseIf kode.Text = "MB4" And tahun.Text = "2013" And kondisi.Text = "Baru" Then
harga.Text = 195000000
ElseIf kode.Text = "MB4" And tahun.Text = "2013" And kondisi.Text = "Bekas" Then
harga.Text = 130000000
ElseIf kode.Text = "MB4" And tahun.Text = "2014" And kondisi.Text = "Baru" Then
harga.Text = 208000000
ElseIf kode.Text = "MB4" And tahun.Text = "2014" And kondisi.Text = "Bekas" Then
harga.Text = 170000000
End If
End Sub
Private Sub jumlah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlah.SelectedIndexChanged
totalharga.Text = Val(jumlah.Text) * Val(harga.Text)
uangmuka.Text = Val(totalharga.Text) * 0.3
komisisales.Text = Val(jumlah.Text) * 0.02 * Val(uangmuka.Text)
End Sub
Sub buattabel()
lv.Columns.Add("Kode", 50, HorizontalAlignment.Center)
lv.Columns.Add("Nama Mobil", 80, HorizontalAlignment.Center)
lv.Columns.Add("Tahun", 50, HorizontalAlignment.Center)
lv.Columns.Add("Kondisi", 50, HorizontalAlignment.Center)
lv.Columns.Add("Harga", 80, HorizontalAlignment.Center)
lv.Columns.Add("Jumlah", 50, HorizontalAlignment.Center)
lv.Columns.Add("Total Harga", 100, HorizontalAlignment.Center)
lv.Columns.Add("Uang Muka ", 100, HorizontalAlignment.Center)
lv.Columns.Add("Komisi Sales", 100, HorizontalAlignment.Center)
lv.Columns.Add("Lama Kredit", 100, HorizontalAlignment.Center)
lv.Columns.Add("Total Kredit", 100, HorizontalAlignment.Center)
lv.Columns.Add("Angsuran Per Bulan", 100, HorizontalAlignment.Center)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub isitabel()
Dim lst As New ListViewItem
lst.Text = kode.Text
lst.SubItems.Add(nm.Text)
lst.SubItems.Add(tahun.Text)
lst.SubItems.Add(kondisi.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jumlah.Text)
lst.SubItems.Add(totalharga.Text)
lst.SubItems.Add(uangmuka.Text)
lst.SubItems.Add(komisisales.Text)
lst.SubItems.Add(lamakredit.Text)
lst.SubItems.Add(totalkredit.Text)
lst.SubItems.Add(angsuranperbulan.Text)
lv.Items.Add(lst)
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
Call isitabel()
kode.Text = ""
nm.Text = ""
tahun.Text = ""
kondisi.Text = ""
harga.Text = ""
jumlah.Text = ""
totalharga.Text = ""
uangmuka.Text = ""
komisisales.Text = ""
lamakredit.Text = ""
totalkredit.Text = ""
angsuranperbulan.Text = ""
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bersih.Click
lv.Items.Clear()
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Dim tanya As String
tanya = MsgBox("Anda Yakin Ingin Keluar", MsgBoxStyle.YesNo)
If tanya = vbYes Then
Me.Close()
End If
End Sub
Private Sub lamakredit_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lamakredit.SelectedIndexChanged
totalkredit.Text = Val(totalharga.Text) - Val(uangmuka.Text)
angsuranperbulan.Text = (Val(totalkredit.Text) * Val(lamakredit.Text * 0.03)) - Val(totalkredit.Text) / Val(lamakredit.Text)
End Sub
End Class
Tampilan Hasil :
Nama : Hendra Syahputra
NPM : 13110660
Selamat Belajar Pemroggraman VB NET
Tidak ada komentar:
Posting Komentar