Quiz Susulan – Soal 2

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s