Senin, 06 Februari 2012

Cara Membuat Kriptografi


Gambar




Listing Untuk Kriptografi

Public Class Form1

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String
        TextBox2.Text = ""
        For i = 1 To Len(TextBox1.Text)
            x = Microsoft.VisualBasic.Mid(TextBox1.Text, i, 1)
            x = Chr(Asc(x) + 3)
            TextBox2.Text = TextBox2.Text & x

        Next i
    End Sub

    Private Sub btndeskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndeskripsi.Click
        Dim x As String
        TextBox3.Text = ""
        For i = 1 To Len(TextBox2.Text)
            x = Microsoft.VisualBasic.Mid(TextBox2.Text, i, 1)
            x = Chr(Asc(x) - 3)
            TextBox3.Text = TextBox3.Text & x

        Next i
    End Sub
End Class
Hasil Gambar


Senin, 30 Januari 2012

Jawaban soal no.3 (_Penggajian Karyawan_)

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        nik.Items.Add("A01")
        nik.Items.Add("B02")
        nik.Items.Add("C03")

       
        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 = "A01" Then
            nama.Text = "Lisa Handayani"
        ElseIf nik.Text = "B02" Then
            nama.Text = "Edi"
        ElseIf nik.Text = "C03" Then
            nama.Text = "Lia Cienaga"
        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

Minggu, 29 Januari 2012

Jawaban soal no.2 (_hal 32 dari model vb net_)

Public Class Form1
    Sub buattabel()
        lv.Columns.Add("NPM", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Nama", 170, HorizontalAlignment.Center)
        lv.Columns.Add("Jurusan", , HorizontalAlignment.Center)
        lv.Columns.Add("Jenjang", 100, HorizontalAlignment.Center)
        lv.Columns.Add("Tahun Masuk", 70, HorizontalAlignment.Center)
        lv.Columns.Add("Nilai Angka", 80, HorizontalAlignment.Center)
        lv.Columns.Add("Nilai Huruf", 80, HorizontalAlignment.Center)
        lv.View = View.Details
        lv.GridLines = True
        lv.FullRowSelect = True

    End Sub
    Sub isitabel()
        Dim ist As New ListViewItem
        With ist
            .Text = npm.Text
            .SubItems.Add(nama.Text)
            .SubItems.Add(jurusan.Text)
            .SubItems.Add(jenjang.Text)
            .SubItems.Add(tmasuk.Text)
            .SubItems.Add(nangka.Text)
            .SubItems.Add(nhuruf.Text)
            lv.Items.Add(ist)
        End With
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        buattabel()

    End Sub

    Private Sub npm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles npm.KeyPress
        If e.KeyChar = Chr(13) Then
            nama.Focus()

        End If
    End Sub

    Private Sub npm_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.TextChanged
        Dim x, y As String
        x = Microsoft.VisualBasic.Mid(npm.Text, 3, 1)
        y = Microsoft.VisualBasic.Mid(npm.Text, 4, 1)
        tmasuk.Text = "20" & Microsoft.VisualBasic.Left(npm.Text, 2)
        If x = "0" Then
            If y = "2" Then

                jenjang.Text = "D-3"
                jurusan.Text = "Manajemen Informatika"


            End If
        ElseIf x = "1" Then
            jenjang.Text = "S-1"
            If x = "1" Then
                jurusan.Text = "Sistem Informasi"
            ElseIf y = "2" Then
                jurusan.Text = "Teknik Informatika"
            End If

        End If
    End Sub

    Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
        isitabel()
        npm.Text = ""
        nama.Text = ""
        jenjang.Text = ""
        jurusan.Text = ""
        tmasuk.Text = ""
        nangka.Text = ""
        nhuruf.Text = ""

    End Sub
    Sub bersih()
        NPM.Text = ""
        Nama.Text = ""
        Jenjang.Text = ""
        jurusan.Text = ""
        tmasuk.Text = ""
        nangka.Text = ""
        nhuruf.Text = ""

    End Sub

    Private Sub nangka_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles nangka.KeyPress
        If e.KeyChar = Chr(13) Then
            If nangka.Text >= 90 Then
                nhuruf.Text = "A"
            ElseIf nangka.Text >= 75 Then
                nhuruf.Text = "B"
            ElseIf nangka.Text >= 60 Then
                nhuruf.Text = "C"
            ElseIf nangka.Text >= 50 Then
                nhuruf.Text = "D"
            Else
                nhuruf.Text = "E"

            End If
        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 btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        npm.Text = ""
        nama.Text = ""
        jenjang.Text = ""
        jurusan.Text = ""
        tmasuk.Text = ""
        nangka.Text = ""
        nhuruf.Text = ""
    End Sub

    Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
        bersih()
    End Sub

    Private Sub btnhapuspilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapuspilih.Click
        lv.Items.Remove(lv.SelectedItems(0))
    End Sub

    Private Sub nangka_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nangka.TextChanged

    End Sub
End Class