Quiz Susulan – Soal 2

0

Berikut ini saya tampilkan form untuk mencari gaji pegawai dengan aplikasi VB :

Gambar

Listing Program :

Public Class Form1

 

    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click

        End

    End Sub

 

    Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click

        golpegawai.Text = “”

        nama.Text = “”

        gajipokok.Text = “”

        pajak.Text = “”

        status.Text = “”

        tunkeluarga.Text = “”

        totgaji.Text = “”

    End Sub

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        golpegawai.Items.Add(“A”)

        golpegawai.Items.Add(“B”)

        golpegawai.Items.Add(“C”)

       

        status.Items.Add(“Menikah”)

        status.Items.Add(“Belum Menikah”)

 

 

    End Sub

 

    Private Sub nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles golpegawai.SelectedIndexChanged

        Select Case golpegawai.Text

            Case “A”

                gajipokok.Text = “2500000”

            Case “B”

                gajipokok.Text = “3500000”

            Case “C”

                gajipokok.Text = “4500000”

        End Select

 

        pajak.Text = 0.1 * gajipokok.Text

 

    End Sub

 

 

   

    Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged

        If status.Text = “Menikah” Then

            tunkeluarga.Text = 0.15 * gajipokok.Text

        Else

            tunkeluarga.Text = 0

        End If

 

        totgaji.Text = Val(gajipokok.Text) – Val(pajak.Text) + Val(tunkeluarga.Text)

    End Sub

 

   

End Class

 

Demikian disampaikan, terimakasih.. 🙂

 

Advertisements

Quiz Susulan – Soal 1

0

Berikut ini saya tampilkan form design untuk mencari total pembayaran air menggunakan VB ListView :

Gambar

Listing program :

Public Class Form1

    Sub BuatTabel()

        LV.Columns.Add(“Kode Pelanggan”, 100, HorizontalAlignment.Center)

        LV.Columns.Add(“Nama”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Tipe”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Daerah”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Harga M3”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Biaya Beban”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Pemakaian Air”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Total Tagihan”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Pajak”, 100, HorizontalAlignment.Left)

        LV.Columns.Add(“Total Pembayaran”, 100, HorizontalAlignment.Left)

        LV.View = View.Details

        LV.GridLines = True

        LV.FullRowSelect = True

    End Sub

    Sub IsiTabel()

        Dim Lst As New ListViewItem

        Lst.Text = kodepelanggan.Text

        Lst.SubItems.Add(nama.Text)

        Lst.SubItems.Add(tipe.Text)

        Lst.SubItems.Add(daerah.Text)

        Lst.SubItems.Add(hargaM3.Text)

        Lst.SubItems.Add(biayabeban.Text)

        Lst.SubItems.Add(pemakaianair.Text)

        Lst.SubItems.Add(totaltagihan.Text)

        Lst.SubItems.Add(pajak.Text)

        Lst.SubItems.Add(totalpembayaran.Text)

        LV.Items.Add(Lst)

    End Sub

 

 

 

    Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click

        kodepelanggan.Text = “”

        nama.Text = “”

        tipe.Text = “”

        totaltagihan.Text = “”

        hargaM3.Text = “”

        pajak.Text = “”

        totalpembayaran.Text = “”

        pemakaianair.Text = “”

        daerah.Text = “”

        biayabeban.Text = “”

 

    End Sub

 

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        kodepelanggan.Items.Add(“TOK-MED-100”)

        kodepelanggan.Items.Add(“PAB-BEL-101”)

        kodepelanggan.Items.Add(“SWA-BEL-102”)

        kodepelanggan.Items.Add(“PAB-MED-103”)

        kodepelanggan.Items.Add(“RUM-MED-104”)

 

        BuatTabel()

    End Sub

 

    Private Sub kodepelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kodepelanggan.SelectedIndexChanged

        Dim x As String

        x = Microsoft.VisualBasic.Right(kodepelanggan.Text, 3)

 

 

 

        If x = “100” Then

            nama.Text = “deni”

        ElseIf x = “101” Then

            nama.Text = “priadi”

        ElseIf x = “102” Then

            nama.Text = “laia”

        ElseIf x = “103” Then

            nama.Text = “dennipri”

        End If

 

 

        x = Microsoft.VisualBasic.Left(kodepelanggan.Text, 3)

 

        If x = “PAB” Then

            hargaM3.Text = 500

            biayabeban.Text = 250000

            tipe.Text = “Pabrik”

        ElseIf x = “TOK” Then

            hargaM3.Text = 500

            biayabeban.Text = 25000

            tipe.Text = “Toko”

        ElseIf x = “RUM” Then

            hargaM3.Text = 500

            biayabeban.Text = 10000

            tipe.Text = “Rumah”

        ElseIf x = “SWA” Then

            hargaM3.Text = 200

            biayabeban.Text = 15000

            tipe.Text = “Swalayan”

        End If

 

        x = Microsoft.VisualBasic.Mid(kodepelanggan.Text, 5, 3)

        If x = “MED” Then

            daerah.Text = “Medan”

        ElseIf x = “BEL” Then

            daerah.Text = “Belawan”

        End If

    End Sub

 

    Private Sub pemakaianair_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles pemakaianair.KeyPress

        If Asc(e.KeyChar) = 13 Then

            totaltagihan.Text = hargaM3.Text * pemakaianair.Text + Val(biayabeban.Text)

            pajak.Text = 0.01 * totaltagihan.Text

            totalpembayaran.Text = Val(totaltagihan.Text) + Val(pajak.Text)

        End If

    End Sub

 

    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click

        End

    End Sub

 

    Private Sub simpankelv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpankelv.Click

        IsiTabel()

        kodepelanggan.Text = “”

        nama.Text = “”

        tipe.Text = “”

        totaltagihan.Text = “”

        hargaM3.Text = “”

        pajak.Text = “”

        totalpembayaran.Text = “”

        pemakaianair.Text = “”

        daerah.Text = “”

        biayabeban.Text = “”

 

    End Sub

 

    Private Sub hapusdataygdipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapusdataygdipilih.Click

        LV.Items.Remove(LV.SelectedItems(0))

    End Sub

 

    Private Sub hapussemuadata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapussemuadata.Click

        LV.Items.Clear()

    End Sub

End Class

 

Demikian disampaikan, terimakasih… 🙂

QUIZ ONLINE NO.1

0

Image

Berikut design Form  dan listing Program :

Public Class Form1

    Sub BuatTabel()

        LV.Columns.Add(“NPM”, 50, HorizontalAlignment.Center)

        LV.Columns.Add(“Nama”, 150, HorizontalAlignment.Left)

        LV.Columns.Add(“Jenjang”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Jurusan”, 150, HorizontalAlignment.Left)

        LV.Columns.Add(“Kode Dosen”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Nama Dosen”, 150, HorizontalAlignment.Left)

        LV.Columns.Add(“Kode Mata Kuliah”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Mata Kuliah”, 150, HorizontalAlignment.Left)

        LV.Columns.Add(“Nilai Kehadiran”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Nilai Tugas”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Nilai UTS”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Nilai UAS”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Nilai Akhir”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Nilai Huruf”, 50, HorizontalAlignment.Left)

        LV.Columns.Add(“Keterangan”, 50, HorizontalAlignment.Left)

        LV.View = View.Details

        LV.GridLines = True

        LV.FullRowSelect = True

    End Sub

    Sub IsiTabel()

        Dim Lst As New ListViewItem

        Lst.Text = npm.Text

        Lst.SubItems.Add(namamhs.Text)

        Lst.SubItems.Add(jenjang.Text)

        Lst.SubItems.Add(jurusan.Text)

        Lst.SubItems.Add(kddosen.Text)

        Lst.SubItems.Add(nmdosen.Text)

        Lst.SubItems.Add(kdmtkuliah.Text)

        Lst.SubItems.Add(mtkuliah.Text)

        Lst.SubItems.Add(nilaikehadiran.Text)

        Lst.SubItems.Add(nilaitugas.Text)

        Lst.SubItems.Add(nilaiuts.Text)

        Lst.SubItems.Add(nilaiuas.Text)

        Lst.SubItems.Add(nilaiakhir.Text)

        Lst.SubItems.Add(nilaihuruf.Text)

        Lst.SubItems.Add(ket.Text)

        LV.Items.Add(Lst)

    End Sub

 

    Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click

 

    End Sub

 

    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click

        End

    End Sub

 

    Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click

        npm.Text = “”

        namamhs.Text = “”

        jenjang.Text = “”

        jurusan.Text = “”

        kddosen.Text = “”

        nmdosen.Text = “”

        kdmtkuliah.Text = “”

        mtkuliah.Text = “”

        nilaikehadiran.Text = “”

        nilaitugas.Text = “”

        nilaiuts.Text = “”

        nilaiuas.Text = “”

        nilaiakhir.Text = “”

        nilaihuruf.Text = “”

        ket.Text = “”

    End Sub

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        npm.Items.Add(“081213”)

        npm.Items.Add(“081214”)

        npm.Items.Add(“081215”)

        kddosen.Items.Add(“012”)

        kddosen.Items.Add(“013”)

        kddosen.Items.Add(“014”)

        kdmtkuliah.Items.Add(“TI01”)

        kdmtkuliah.Items.Add(“TI02”)

        kdmtkuliah.Items.Add(“TI03”)

 

        Dim x As Byte

        For x = 10 To 100

            nilaikehadiran.Items.Add(x)

            nilaitugas.Items.Add(x)

            nilaiuts.Items.Add(x)

            nilaiuas.Items.Add(x)

        Next

 

        BuatTabel()

    End Sub

 

    Private Sub npm_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.SelectedIndexChanged

        Select Case npm.Text

            Case “121113”

                namamhs.Text = “Deni Priadi La’ia”

                jenjang.Text = “Diploma I”

                jurusan.Text = “Sistem Informasi”

            Case “121114”

                namamhs.Text = “Ucok”

                jenjang.Text = “Diploma III”

                jurusan.Text = “Manejemen Informasi”

            Case “121115”

                namamhs.Text = “Deni La’ia”

                jenjang.Text = “Strata I”

                jurusan.Text = “Teknik Informasi”

        End Select

    End Sub

 

    Private Sub kodedosen_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kddosen.SelectedIndexChanged

        Select Case kddosen.Text

            Case “0012”

                nmdosen.Text = “Mesran”

            Case “0013”

                nmdosen.Text = “Alex”

            Case “0014”

                nmdosen.Text = “harvei”

        End Select

    End Sub

 

    Private Sub kodematakuliah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kdmtkuliah.SelectedIndexChanged

        Select Case kdmtkuliah.Text

            Case “TI01”

                mtkuliah.Text = “Pemograman Visual”

            Case “TI02”

                mtkuliah.Text = “Sistem Basis Data”

            Case “TI03”

                mtkuliah.Text = “Database”

        End Select

    End Sub

 

    Private Sub proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles proses.Click

        nilaiakhir.Text = 0.1 * nilaikehadiran.Text + 0.15 * nilaitugas.Text + 0.3 * nilaiuts.Text + 0.45 * nilaiuas.Text

 

        If nilaiakhir.Text >= 80 Then

            nilaihuruf.Text = “A”

        ElseIf nilaiakhir.Text >= 70 Then

            nilaihuruf.Text = “B”

        ElseIf nilaiakhir.Text >= 60 Then

            nilaihuruf.Text = “C”

        ElseIf nilaiakhir.Text >= 50 Then

            nilaihuruf.Text = “D”

        Else

            nilaihuruf.Text = “E”

        End If

 

        If nilaiakhir.Text >= 60 Then

            ket.Text = “LULUS”

        Else

            ket.Text = “GAGAL”

        End If

    End Sub

 

    Private Sub simpankelistview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpankelistview.Click

        IsiTabel()

        npm.Text = “”

        namamhs.Text = “”

        jenjang.Text = “”

        jurusan.Text = “”

        kddosen.Text = “”

        nmdosen.Text = “”

        kdmtkuliah.Text = “”

        mtkuliah.Text = “”

        nilaikehadiran.Text = “”

        nilaitugas.Text = “”

        nilaiuts.Text = “”

        nilaiuas.Text = “”

        nilaiakhir.Text = “”

        nilaihuruf.Text = “”

        ket.Text = “”

 

 

    End Sub

 

    Private Sub hapusdataygdipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapusdataygdipilih.Click

        LV.Items.Remove(LV.SelectedItems(0))

    End Sub

 

    Private Sub hapussemuadata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapussemuadata.Click

        LV.Items.Clear()

    End Sub

End Class