Minggu, 29 Januari 2012

Jawaban Soal No 3 (Ihsan Dedy Boy Marpaung)

 Kasus Tagihan PDAM

Public Class Form1

    Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click
        If nama.Text = "ihsan" And password.Text = "020690" Then
            PDAM.Show()
            Me.Hide()
        Else
            MsgBox("username or password yg anda input salah")
            nama.Text = ""
            password.Text = ""

        End If
    End Sub

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

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

    End Sub
End Class


Public Class PDAM

    Private Sub TagihanPDAMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TagihanPDAMToolStripMenuItem.Click
        Form3.Show()
    End Sub

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

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

    End Sub
End Class
Public Class Form3

    Private Sub kode_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles kode.KeyPress
        If Asc(e.KeyChar) = 13 Then
            Dim x As String
            x = Microsoft.VisualBasic.Left(kode.Text, 3)
            If x = "pab" Then
                tipe.Text = "pabrik"
                harga.Text = "500"
                Beban.Text = "250000"

            ElseIf x = "tok" Then
                tipe.Text = "toko"
                harga.Text = "300"
                Beban.Text = "25000"

            ElseIf x = "rum" Then
                tipe.Text = "rumah"
                harga.Text = "100"
                Beban.Text = "15000"

            ElseIf x = "swa" Then
                tipe.Text = "swalayan"
                harga.Text = "200"
                Beban.Text = "10000"

            End If
            x = Microsoft.VisualBasic.Mid(kode.Text, 5, 3)
            If x = "med" Then
                daerah.Text = "medan"
            ElseIf x = "bel" Then
                daerah.Text = "belawan"
            ElseIf x = "tem" Then
                daerah.Text = "aksara"
            ElseIf x = "mar" Then
                daerah.Text = "marendal"
            ElseIf x = "bin" Then
                daerah.Text = "binjai"
            ElseIf x = "pak" Then
                daerah.Text = "lubuk pakam"
            End If
            nomor.Text = Microsoft.VisualBasic.Right(kode.Text, 3)

        End If
    End Sub


    Private Sub jumlahpakai_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumlahpakai.KeyPress
        If Asc(e.KeyChar) = 13 Then
            besar.Text = jumlahpakai.Text * harga.Text
            total.Text = Val(Beban.Text) + Val(harga.Text) * besar.Text
            pajak.Text = total.Text * 0.01
            jumlah.Text = Val(total.Text) + Val(pajak.Text)
        End If
    End Sub

    Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
        kode.Text = ""
        nomor.Text = ""
        daerah.Text = ""
        tipe.Text = ""
        harga.Text = ""
        Beban.Text = ""
        jumlahpakai.Text = ""
        besar.Text = ""
        total.Text = ""
        pajak.Text = ""
        jumlah.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 Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Tidak ada komentar:

Posting Komentar