Senin, 20 Mei 2013

Mei 20, 2013 Posted by Dayat Java No comments
Posted by Dayat Java on Mei 20, 2013 with No comments
TUGAS BAHASA PEMROGRAMAN


Desain program


listing /syntax program


Public Class Form1
    Sub BuatTabel()
        Lv.Columns.Add("NIK", 100, HorizontalAlignment.Center)
        Lv.Columns.Add("Nama", 100, HorizontalAlignment.Left)
        Lv.Columns.Add("Jabatan", 100, HorizontalAlignment.Center)
        Lv.Columns.Add("Gaji", 100, HorizontalAlignment.Center)
        Lv.Columns.Add("Status", 100, HorizontalAlignment.Center)
        Lv.Columns.Add("Tunj.Keluarga", 100, HorizontalAlignment.Center)
        Lv.Columns.Add("Pajak", 100, HorizontalAlignment.Center)
        Lv.Columns.Add("Total Gaji", 100, HorizontalAlignment.Center)
        Lv.View = View.Details
        Lv.GridLines = True
        Lv.FullRowSelect = True
    End Sub
    Sub IsiTabel()
        Dim lst As New ListViewItem
        lst.Text = Nik.Text
        lst.SubItems.Add(nama.Text)
        lst.SubItems.Add(jab.Text)
        lst.SubItems.Add(gaji.Text)
        lst.SubItems.Add(stt.Text)
        lst.SubItems.Add(tunj.Text)
        lst.SubItems.Add(pajak.Text)
        lst.SubItems.Add(total.Text)
        Lv.Items.Add(lst)
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Nik.Items.Add("001")
        Nik.Items.Add("002")
        Nik.Items.Add("003")
        jab.Items.Add("Mandor")
        jab.Items.Add("Kepala bagian")
        jab.Items.Add("staf")
        stt.Items.Add("Menikah")
        stt.Items.Add("Belum Menikah")

        BuatTabel()
    End Sub

    Private Sub Nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nik.SelectedIndexChanged
        Select Case Nik.Text
            Case "001" : nama.Text = "oncom"
            Case "002" : nama.Text = "Udin"
            Case "003" : nama.Text = "ujang"
        End Select
    End Sub

    Private Sub jab_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jab.SelectedIndexChanged
        Select Case jab.Text
            Case "Mandor" : gaji.Text = 1750000
            Case "Kepala bagian" : gaji.Text = 2500000
            Case "staf" : gaji.Text = 1250000
        End Select
        pajak.Text = 0.15 * gaji.Text
    End Sub

    Private Sub stt_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stt.SelectedIndexChanged
        Select Case stt.Text
            Case "Menikah" : tunj.Text = 0.15 * gaji.Text
            Case "Belum Menikah" : tunj.Text = 0
        End Select
    End Sub
    Private Sub proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles proses.Click
        total.Text = Val(gaji.Text) + Val(tunj.Text) - Val(pajak.Text)
    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
        Lv.Items.Clear()
    End Sub

    Private Sub hapus1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus1.Click
        Lv.Items.Remove(Lv.SelectedItems(0))
    End Sub

    Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
        IsiTabel()
        Nik.Text = ""
        nama.Text = ""
        jab.Text = ""
        stt.Text = ""
        pajak.Text = ""
        tunj.Text = ""
        gaji.Text = ""
        total.Text = ""
    End Sub

    Private Sub Lv_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lv.SelectedIndexChanged

    End Sub

End Class


Tampilan saat program dijalankan
 


 Tampilan untuk mencoba program

 
Saat menyimpan pada listview

0 $type={blogger}:

Posting Komentar