Minggu, 07 Desember 2014

Yuk! Belajar Pemrograman VB

Selesaikanlah Kasus Berikut :

Tugas Praktikum PENJUALAN KREDIT MOBIL

 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")

        Kondisi.Items.Add("Baru")
        Kondisi.Items.Add("Bekas")

        LKredit.Items.Add("12")
        LKredit.Items.Add("24")
        LKredit.Items.Add("36")
        LKredit.Items.Add("48")

    End Sub
    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged

        If Kode.Text = "MB1" Then
            Mobil.Text = "Avanza Velos"
        ElseIf Kode.Text = "MB2" Then
            Mobil.Text = "Avanza G"
        ElseIf Kode.Text = "MB3" Then
            Mobil.Text = "Zenia G"
        ElseIf Kode.Text = "MB4" Then
            Mobil.Text = "Yaris"
        End If

    End Sub
    Private Sub Kondisi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kondisi.SelectedIndexChanged

        If Kondisi.Text = "Baru" And Kode.Text = "MB1" And Tahun.Text = "2012" Then
            Harga.Text = 175000000
        ElseIf Kondisi.Text = "Bekas" And Kode.Text = "MB1" And Tahun.Text = "2012" Then
            Harga.Text = 120000000
        ElseIf Kondisi.Text = "Baru" And Kode.Text = "MB1" And Tahun.Text = "2013" Then
            Harga.Text = 195000000
        ElseIf Kondisi.Text = "Bekas" And Kode.Text = "MB1" And Tahun.Text = "2013" Then
            Harga.Text = 130000000
        ElseIf Kondisi.Text = "Baru" And Kode.Text = "MB1" And Tahun.Text = "2014" Then
            Harga.Text = 208000000
        ElseIf Kondisi.Text = "Bekas" And Kode.Text = "MB1" And Tahun.Text = "2014" Then
            Harga.Text = 170000000
        End If

    End Sub
    Private Sub beli_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles beli.TextChanged

        THarga.Text = Val(beli.Text) * Harga.Text
        Komisi.Text = 0.02 * Val(beli.Text) * Val(Uang.Text)

    End Sub
    Private Sub Harga_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Harga.TextChanged

        Uang.Text = 0.3 * Harga.Text

    End Sub
    Private Sub Uang_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Uang.TextChanged

        TKredit.Text = Harga.Text - Uang.Text

    End Sub
    Private Sub LKredit_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LKredit.SelectedIndexChanged

        Angsuran.Text = (TKredit.Text + Val(0.03 * TKredit.Text)) / Val(LKredit.Text)

    End Sub
    Sub BuatTabel()

        Lv.Columns.Add("Kode Barang", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Merk Mobil", 100, HorizontalAlignment.Left)
        Lv.Columns.Add("Tahun", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Kondisi", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("harga", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Jumlah Beli", 50, HorizontalAlignment.Center)
        Lv.Columns.Add("Total Harga", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Uang Muka", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Komisi Sales", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Lama Kredit", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Total Kredit", 75, HorizontalAlignment.Center)
        Lv.Columns.Add("Angsuran Bulanan", 75, 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(Mobil.Text)
        Lst.SubItems.Add(Tahun.Text)
        Lst.SubItems.Add(Kondisi.Text)
        Lst.SubItems.Add(Harga.Text)
        Lst.SubItems.Add(beli.Text)
        Lst.SubItems.Add(THarga.Text)
        Lst.SubItems.Add(Uang.Text)
        Lst.SubItems.Add(Komisi.Text)
        Lst.SubItems.Add(LKredit.Text)
        Lst.SubItems.Add(TKredit.Text)
        Lst.SubItems.Add(Angsuran.Text)
        Lv.Items.Add(Lst)

    End Sub

    Private Sub BtnIsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIsi.Click

        Call IsiTabel()

    End Sub

    Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click
        Lv.Items.Clear()
    End Sub

    Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
        Me.Close()
    End Sub
End Class


Demikianlah Postingan Saya

Nama : RIKI SYAHPUTRA
NPM : 13110451

Selamat Belajar PEMROGRAMAN VB NET




 


Tidak ada komentar:

Posting Komentar