Minggu, 29 Januari 2012

Jawaban No. 3 (Rahmad Eko Syahputra)

Jawaban No. 3
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        nik.Items.Add("1001")
        nik.Items.Add("1002")
        nik.Items.Add("1003")

       
        Jabatan.Items.Add("Mandor")
        Jabatan.Items.Add("Kepala Bagian")
        Jabatan.Items.Add("Staff")

        status.Items.Add("Belum Menikah")
        status.Items.Add("Menikah")

        jmlhlmbur.Items.Add("1 jam")
        jmlhlmbur.Items.Add("2 jam")
        jmlhlmbur.Items.Add("3 jam")
       
    End Sub

    Private Sub nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nik.SelectedIndexChanged
        If nik.Text = "1001" Then
            nama.Text = "Julianti Putri"
        ElseIf nik.Text = "1002" Then
            nama.Text = "Rahmad Eko"
        ElseIf nik.Text = "1003" Then
            nama.Text = "Rada Dewi"
        Else
            nama.Text = "Empty"
        End If
    End Sub

    Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
        If status.Text = "Belum Menikah" Then
            tunjanak.Text = 0
            tunjistri.Text = 0
        ElseIf status.Text = "Menikah" Then
            tunjistri.Text = 175000
        Else
            tunjanak.Text = 0
            tunjistri.Text = 0
        End If
    End Sub

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        If jumlahank.Text <= 2 Then
            tunjanak.Text = jumlahank.Text * (0.03 * gaji.Text)
        ElseIf jumlahank.Text >= 2 Then
            tunjanak.Text = jumlahank.Text * (0.07 * gaji.Text)
        End If
        If jmlhlmbur.Text = "1 jam" Then
            Lembur.Text = 7500
        ElseIf jmlhlmbur.Text = "2 jam" Then
            Lembur.Text = 10000
        ElseIf jmlhlmbur.Text = "3 jam" Then
            Lembur.Text = 15000
        Else
            Lembur.Text = 0
        End If
        Pajak.Text = 0.015 * gaji.Text
        Total.Text = Val(gaji.Text) + Val(tunjanak.Text) + Val(tunjistri.Text) + Val(Lembur.Text) - Val(Pajak.Text)
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        nik.Text = ""
        nama.Text = ""
        Jabatan.Text = ""
        gaji.Text = ""
        status.Text = ""
        jumlahank.Text = ""
        tunjistri.Text = ""
        tunjanak.Text = ""
        Pajak.Text = ""
        Lembur.Text = ""
        jmlhlmbur.Text = ""
        Total.Text = ""
        nik.Focus()
    End Sub

    Sub bonusgaji()
        If status.Text = "MENIKAH" Then
            tunjistri.Text = 0.09 * gaji.Text
            If jumlahank.Text = "1" Then
                tunjanak.Text = 0.03 * gaji.Text
            ElseIf jumlahank.Text = "2" Then
                tunjanak.Text = 0.07 * gaji.Text
            ElseIf jumlahank.Text >= "2" Then
                tunjanak.Text = 0.07 * gaji.Text
            End If
        Else
            tunjistri.Text = "0"
            tunjanak.Text = "0"
        End If

    End Sub

    Private Sub Jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jabatan.SelectedIndexChanged
        If Jabatan.Text = "Mandor" Then
            gaji.Text = 1750000
        ElseIf Jabatan.Text = "Kepala Bagian" Then
            gaji.Text = 2500000
        ElseIf Jabatan.Text = "Staff" Then
            gaji.Text = 1250000
        Else
            gaji.Text = 0
        End If
    End Sub


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


    Private Sub jmlhlmbur_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jmlhlmbur.SelectedIndexChanged
        If Jabatan.Text = "mandor" Then
            Lembur.Text = 7500
        ElseIf Jabatan.Text = "kepala bagian" Then
            Lembur.Text = 10000
        ElseIf Jabatan.Text = "staff" Then
            Lembur.Text = 5000
        Else
            Lembur.Text = 0
        End If
    End Sub
End Class


1 komentar: