Sabtu, 28 November 2015

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



Soal :

Buatlah output seperti tampilan berikut ini :

Informasi Pembayaran Gaji
------------------------------------------------------------------------------------------------
No   NIK   Nama Pegawai       Gol   Gaji Pokok      Pajak    Gaji Bersih
------------------------------------------------------------------------------------------------
 9
 9
 9
 ..
 ..
------------------------------------------------------------------------------------------------



Ketentuan Proses

1. NIK, Gol INPUT
2. Proses Nama Pegawai
     Jika NIK = 1 maka
                  Nama Pegawai = "Hendro"
     Jika NIK = 2 maka
                  Nama Pegawai = "Dian"
     Jika NIK = 3 maka
                  Nama Pegawai = "Jhoni"

3. Proses Gaji Pokok
     Jika GOL = 1 maka
                  GajiPokok= 1500000
     Jika GOL = 2 maka
                  GajiPokok= 2500000
     Jika GOL = 3 maka
                  GajiPokok= 3500000

4. Pajak = 0.05 * Gaji Pokok
5. Gaji Bersih = Gaji Pokok - Pajak




Berikut Jawaban Program :
Public Class Form1
--------------------------------------------------------------------------------------------------------------------------
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LV.Columns.Add("No", 40, HorizontalAlignment.Center)
        LV.Columns.Add("NIK", 40, HorizontalAlignment.Center)
        LV.Columns.Add("Nama Pegawai", 100, HorizontalAlignment.Left)
        LV.Columns.Add("Gol", 40, HorizontalAlignment.Left)
        LV.Columns.Add("Gaji Pokok", 120, HorizontalAlignment.Left)
        LV.Columns.Add("Pajak", 120, HorizontalAlignment.Left)
        LV.Columns.Add("Gaji Bersih", 120, HorizontalAlignment.Left)
        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True
        Nik.Items.Add("1")
        Nik.Items.Add("2")
        Nik.Items.Add("3")
        Golongan.Items.Add("1")
        Golongan.Items.Add("2")
        Golongan.Items.Add("3")

    End Sub
--------------------------------------------------------------------------------------------------------------------------
    Private Sub Nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nik.SelectedIndexChanged

        If Nik.Text = "1" Then
            Nama_Pegawai.Text = "Hendro"
        ElseIf Nik.Text = "2" Then
            Nama_Pegawai.Text = "Dian"
        ElseIf Nik.Text = "3" Then
            Nama_Pegawai.Text = "Jhoni"
        End If
    End Sub
--------------------------------------------------------------------------------------------------------------------------
    Private Sub Golongan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Golongan.SelectedIndexChanged
        If Golongan.Text = "1" Then
            Gaji_Pokok.Text = "1500000"
        ElseIf Golongan.Text = "2" Then
            Gaji_Pokok.Text = "2500000"
        ElseIf Golongan.Text = "3" Then
            Gaji_Pokok.Text = "3500000"
        End If

    End Sub
--------------------------------------------------------------------------------------------------------------------------
    Private Sub Btn_Proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Proses.Click
        Pajak.Text = 0.05 * Gaji_Pokok.Text
        Gaji_Bersih.Text = Gaji_Pokok.Text - Pajak.Text
        Dim lst As New ListViewItem
        lst.Text = "9"
        lst.SubItems.Add(Nik.Text)
        lst.SubItems.Add(Nama_Pegawai.Text)
        lst.SubItems.Add(Golongan.Text)
        lst.SubItems.Add(Gaji_Pokok.Text)
        lst.SubItems.Add(Pajak.Text)
        lst.SubItems.Add(Gaji_Bersih.Text)
        LV.Items.Add(lst)
    End Sub
--------------------------------------------------------------------------------------------------------------------------
    Private Sub Btn_Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Hapus.Click
        Nik.Text = ""
        Nama_Pegawai.Text = ""
        Golongan.Text = ""
        Pajak.Text = ""
        Gaji_Pokok.Text = ""
        Gaji_Bersih.Text = ""

    End Sub
--------------------------------------------------------------------------------------------------------------------------
    Private Sub Hapus_List_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_List.Click
        LV.Items.Clear()
    End Sub
--------------------------------------------------------------------------------------------------------------------------
 Private Sub Btn_Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Keluar.Click
        End
    End Sub
End Class
--------------------------------------------------------------------------------------------------------------------------

Tampilan Hasil:



Demikilahlah postingan saya


Nama : Sariaman Sihombing
 NPM : 14110462
Selamat Belajar Pemrograman VB NET

Tidak ada komentar:

Posting Komentar

Jangan cuma di lihat aja, tinggalin komentar juga ya...