Random Post

Pages

Minggu, 07 Desember 2014

Yuk! Belajar Pemrograman Visual Basic dot Net Di Mesran.Net

Selesaikanlah Kasus Berikut:
Berikut jawaban Program:

Berikut Coding Program:


Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Kode.Items.Add("PAB-PAK-100")
        Kode.Items.Add("RUM-MED-101")
        Kode.Items.Add("SWA-BEL-102")
        Kode.Items.Add("TOK-TEM-103")
        Kode.Items.Add("PAB-MAR-100")
        Kode.Items.Add("TOK-BIN-103")

        Call BUAT_TABEL()

    End Sub


    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
        If Kode.Text = "PAB-PAK-100" Then
            nama.Text = "RIZKA DWI PRATIWI"
        ElseIf Kode.Text = "RUM-MED-101" Then
            nama.Text = "WIKA YUNITA SARI"
        ElseIf Kode.Text = "SWA-BEL-102" Then
            nama.Text = "ADITYA NUGRAHA"
        ElseIf Kode.Text = "TOK-TEM-103" Then
            nama.Text = "RIZKI AMALIA"
        ElseIf Kode.Text = "PAB-MAR-100" Then
            nama.Text = "YUDHA TRI ANANDA"
        ElseIf Kode.Text = "TOK-BIN-103" Then
            nama.Text = "GUSLINDA AIRANGGA"
        End If

        Dim X As String
        X = Mid(Kode.Text, 1, 3)
        Select Case X
            Case "TOK"
                tipe.Text = "TOKO"
                biayabeban.Text = 150000
                hargakwh.Text = 500

            Case "RUM"
                tipe.Text = "RUMAH"
                biayabeban.Text = 50000
                hargakwh.Text = 200

            Case "SWA"
                tipe.Text = "SWALAYAN"
                biayabeban.Text = 400000
                hargakwh.Text = 1500

            Case "PAB"
                tipe.Text = "PABRIK"
                biayabeban.Text = 1000000
                hargakwh.Text = 10000
        End Select

        X = Mid(Kode.Text, 5, 3)
        Select Case X
            Case "MED"
                daerah.Text = "MEDAN"
            Case "BEL"
                daerah.Text = "BELAWAN"
            Case "TEM"
                daerah.Text = "AKSARA"
            Case "MAR"
                daerah.Text = "MARENDAL"
            Case "BIN"
                daerah.Text = "BINJAI"
            Case "PAK"
                daerah.Text = "LUBUK PAKAM"
        End Select

    End Sub

    Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
        Pemakaian.Text = MBulanini.Text - MBulanlalu.Text
        ttl_tagihan.Text = (Val(biayabeban.Text) + Val(hargakwh.Text)) * Pemakaian.Text
        pajak.Text = 0.015 * ttl_tagihan.Text
        pembayaran.Text = Val(ttl_tagihan.Text) + Val(pajak.Text)
    End Sub
    Sub BUAT_TABEL()
        LV.Columns.Add("Kode Pelanggan", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Nama", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Tipe Pelanggan", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Daerah", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Biaya Beban", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Harga per KWH", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Meter Bulan ini", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Meter Bulan Lalu", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Pemakaian", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Total Tagihan", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Pajak", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Pembayaran", 100, HorizontalAlignment.Center)

        LV.GridLines = True
        LV.FullRowSelect = True
        LV.View = View.Details
    End Sub
    Sub ISI_TABEL()
        Dim X As New ListViewItem
        X.Text = Kode.Text
        X.SubItems.Add(nama.Text)
        X.SubItems.Add(tipe.Text)
        X.SubItems.Add(daerah.Text)
        X.SubItems.Add(biayabeban.Text)
        X.SubItems.Add(hargakwh.Text)
        X.SubItems.Add(MBulanini.Text)
        X.SubItems.Add(MBulanlalu.Text)
        X.SubItems.Add(Pemakaian.Text)
        X.SubItems.Add(ttl_tagihan.Text)
        X.SubItems.Add(pajak.Text)
        X.SubItems.Add(pembayaran.Text)

        LV.Items.Add(X)
    End Sub

    Private Sub Btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapus.Click
        Kode.Text = ""
        nama.Text = ""
        tipe.Text = ""
        daerah.Text = ""
        biayabeban.Text = ""
        hargakwh.Text = ""
        MBulanini.Text = ""
        MBulanlalu.Text = ""
        Pemakaian.Text = ""
        ttl_tagihan.Text = ""
        pajak.Text = ""
        pembayaran.Text = ""

    End Sub

    Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
        End
    End Sub

    Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
        Call ISI_TABEL()

    End Sub

    Private Sub btnhapus1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus1.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        LV.Items.Clear()

    End Sub
End Class

Berikut Hasil Setelah Program Dijalankan:
Demikianlah postingan saya
Nama:  Rizka Dwi Pratiwi
Npm:13110453
Kelas:SI-P1302

Selamat Belajar Pemrograman VB NET


Tidak ada komentar:

Posting Komentar