Selasa, 21 Mei 2013

Tugas Program Visual Basic

Tugas Bahasa Pemrograman






Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
npm.Items.Add("1111046")
npm.Items.Add("1111047")
npm.Items.Add("1111045")
npm.Items.Add("1102094")
npm.Items.Add("1102086")

jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
jabatan.Items.Add("Staf")
jabatan.Items.Add("Manajer")
jabatan.Items.Add("Administrasi")

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

For i = 1 To 4
Janak.Items.Add(i)
Next i
For i = 1 To 10
Jlembur.Items.Add(i)
Next i
BuatTabel()
End Sub

Private Sub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
Select Case jabatan.Text
Case "Mandor" : gaji.Text = 1750000
Case "Kepala Bagian" : gaji.Text = 2500000
Case "Staf" : gaji.Text = 1250000
Case "Manajer" : gaji.Text = 3000000
Case "Administrasi" : gaji.Text = 1350000
End Select
pajak.Text = 0.015 * gaji.Text
End Sub

Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
Select Case status.Text
Case "Menikah" : Tistri.Text = 0.09 * gaji.Text
Case "Tidak Menikah" : Tistri.Text = 0
End Select
End Sub

Private Sub Janak_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Janak.SelectedIndexChanged
If Janak.Text >= 2 And status.Text = "Menikah" Then
Tanak.Text = 0.07 * gaji.Text
ElseIf Janak.Text = 1 And status.Text = "Menikah" Then
Tanak.Text = 0.03 * gaji.Text
Else
Tanak.Text = 0
End If
End Sub

Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
If jabatan.Text = "Mandor" Then
Ulembur.Text = 7500
ElseIf jabatan.Text = "Kepala Bagian" Then
Ulembur.Text = 10000
ElseIf jabatan.Text = "Staf" Then
Ulembur.Text = 5000
Else
Ulembur.Text = 0
End If

tot.Text = Val(Ulembur.Text * Jlembur.Text) + Val(gaji.Text) + Val(Tistri.Text) + Val(Tanak.Text) - Val(pajak.Text)

Call IsiTabel()
End Sub
Sub BuatTabel()
LV.Columns.Add("Npm", 80, HorizontalAlignment.Center)
LV.Columns.Add("Nama", 80, HorizontalAlignment.Center)
LV.Columns.Add("Jabatan", 80, HorizontalAlignment.Center)
LV.Columns.Add("Gaji", 80, HorizontalAlignment.Center)
LV.Columns.Add("status", 80, HorizontalAlignment.Center)
LV.Columns.Add("Tunjangan Istri", 80, HorizontalAlignment.Center)
LV.Columns.Add("Jumlah Anak", 80, HorizontalAlignment.Center)
LV.Columns.Add("Tunjangan Anak", 80, HorizontalAlignment.Center)
LV.Columns.Add("Jam Lembur", 80, HorizontalAlignment.Center)
LV.Columns.Add("Honor Lembur", 80, HorizontalAlignment.Center)
LV.Columns.Add("Pajak", 80, HorizontalAlignment.Center)
LV.Columns.Add("Total", 180, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub

Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = Nama.Text
Lst.Text = Jabatan.Text
Lst.Text = Gaji.Text
Lst.Text = Status.Text
Lst.Text = npm.Text
Lst.SubItems.Add(Nama.Text)
Lst.SubItems.Add(Jabatan.Text)
Lst.SubItems.Add(Gaji.Text)
Lst.SubItems.Add(Status.Text)
Lst.SubItems.Add(Tistri.Text)
Lst.SubItems.Add(Janak.Text)
Lst.SubItems.Add(Tanak.Text)
Lst.SubItems.Add(Jlembur.Text)
Lst.SubItems.Add(Ulembur.Text)
Lst.SubItems.Add(Pajak.Text)
Lst.SubItems.Add(Tot.Text)
Lst.SubItems.Add(npm.Text)
LV.Items.Add(Lst)
End Sub
End Class



Hasil Design Program












Tidak ada komentar:

Posting Komentar