Minggu, 03 April 2011

TUGAS VISUAL BASIC 2 - Program menghitung jumlah biaya konsumen pada rumah makan

Pada tugas visual basic yang ke-2 ini saya mencoba membuat program menghitung,tidak jauh beda dari tugas pertama cuma hanya menambahkan beberapa koding-koding baru,seperti messege box,clear dll.berikut adalah programnya

form 1











beriktut adalah koding form 1


Public Class Form1

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x As String
        x = MsgBox("Yakin Keluar", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Konfirmasi")
        If x = vbYes Then

        End If
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = "0"
        TextBox2.Text = "0"
        TextBox3.Text = "0"
        TextBox4.Text = "0"
        TextBox5.Text = "0"
        TextBox6.Text = "0"
        TextBox7.Text = "0"
        TextBox8.Text = "0"
        TextBox9.Text = "0"
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Form2.Show()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub


      Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged


    End Sub

    Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
        If ComboBox3.Text = "Jus" Then
            TextBox1.Text = "5000"
        Else
        End If

        If ComboBox3.Text = "Kopi" Then
            TextBox1.Text = "2000"
        Else
        End If

        If ComboBox3.Text = "Teh manis" Then
            TextBox1.Text = "2000"
        Else
        End If

        If ComboBox3.Text = "Minuman botol" Then
            TextBox1.Text = "2500"
        Else
        End If
        If ComboBox3.Text = "Minuman kaleng" Then
            TextBox1.Text = "4500"
        Else
        End If

        If ComboBox3.Text = "Air putih" Then
            TextBox1.Text = "0"

        End If


    End Sub

    Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
        If ComboBox4.Text = "Pisang" Then
            TextBox5.Text = "1000"
        Else
        End If

        If ComboBox4.Text = "Apel" Then
            TextBox5.Text = "4000"
        Else
        End If

        If ComboBox4.Text = "Jeruk" Then
            TextBox5.Text = "1500"
        Else
        End If

        If ComboBox4.Text = "Gorengan" Then
            TextBox5.Text = "500"
        Else
        End If
        If ComboBox4.Text = "Puding" Then
            TextBox5.Text = "2500"

        End If

    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        If ComboBox2.Text = "Ayam" Then
            TextBox3.Text = "5000"
        Else
        End If

        If ComboBox2.Text = "Daging" Then
            TextBox3.Text = "6000"
        Else
        End If

        If ComboBox2.Text = "Telur" Then
            TextBox3.Text = "2000"
        Else
        End If

        If ComboBox2.Text = "Ikan" Then
            TextBox3.Text = "4000"
        Else
        End If
        If ComboBox2.Text = "Sea food" Then
            TextBox3.Text = "5000"
        Else
        End If

        If ComboBox2.Text = "Hati ampela" Then
            TextBox3.Text = "4000"
        Else
        End If

        If ComboBox2.Text = "Kikil" Then
            TextBox3.Text = "5000"

        End If

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.Text = "1" Then
            TextBox4.Text = "14000"
        Else
        End If

        If ComboBox1.Text = "2" Then
            TextBox4.Text = "19000"
        Else
        End If

        If ComboBox1.Text = "3" Then
            TextBox4.Text = "15000"
        Else
        End If

        If ComboBox1.Text = "4" Then
            TextBox4.Text = "18000"

        End If
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox7.Text = TextBox2.Text + +TextBox3.Text + +TextBox1.Text + +TextBox5.Text + +TextBox4.Text

        TextBox9.Text = TextBox7.Text - TextBox8.Text
    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
        TextBox2.Text = TextBox6.Text * 3000
    End Sub

    Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
        TextBox8.Text = TextBox7.Text * 0.1
    End Sub

    Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox9.TextChanged

    End Sub
End Class




pada form ini kita bisa memasukkan data makanan yang telah kita pilih,jika ingin memilih paket kita bisa melihatnya di form 2 dengan cara mengklik button "Lihat paket".di form ini juga tersedia button untuk mengisi ulang lagi data/membuat data yang baru, dan menutup data dengan memberikan konfirmasi terlebih dahulu.



form 2





pada form ini kita bisa melihat berbagai macam paket yang tersedia,jika ingin memilih salah satu paket kita mesti mengisi datanya di form 1.

Terima kasih Atas perhatiannya.Jika ada salh mohon di maafkan.

Minggu, 06 Maret 2011

Visual Studio (Toko Olahraga)

Ibrahim Husein Lubis(1006724406)
Vokasi Akuntansi Teknologi Sistem Informasi
Universitas Indonesia

Penjelasan
  Pada tugas visual basic ini saya membuat aplikasi  penjualan barang-barang olahraga dengan memakai kurs dollar.dengan tujuan untuk memudahkan pengguna dalam melayani pembeli dan jika pembeli membawa uang Rp maka akan bisa langusung di tukar ke dollar,
berikut adalah penjelasan dan cara menjalankan program ini:
1. Kita harus memasukkan uang kita Rp atau $ ke textbox1 atau 2.
2. Cari nama barang yang ingin kita beli di combobox1
3. Jika barangya sedang promo akan muncul di textbox5,dan kita klik button Total Harga Diskon maka akan keluar harga barang yang sedang promo tersebut
4. Masukkan jumlah barang yang ingin kita beli di combobox2
5. Klik button total,maka akan keluar jumlah harga keseluruhan yang akan kita bayar,
6. Klik button kembalian,maka akan keluar sisa uang belanja.


Kodingnya :

Public Class Form1
   
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox6.Text = TextBox3.Text * ComboBox2.Text

    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox3.Text = TextBox4.Text - TextBox5.Text

    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.Text = "nike lari" Then
            TextBox4.Text = "$50"
        Else
            If ComboBox1.Text = "nike futsal" Then
                TextBox4.Text = "$65"
            Else
                If ComboBox1.Text = "adidas futsal" Then
                    TextBox4.Text = "$40"
                Else
                    If ComboBox1.Text = "adidas lari" Then
                        TextBox4.Text = "$60"
                    Else
                        If ComboBox1.Text = "jersey" Then
                            TextBox4.Text = "$80"
                        Else
                            If ComboBox1.Text = "perset(kaoskaki,sepatu,bola)" Then
                                TextBox4.Text = "$200"
                            End If
                        End If
                    End If
                End If
            End If
        End If
        If ComboBox1.Text = "nike futsal" Then
            TextBox5.Text = 65 * 5 / 100
        Else
            If ComboBox1.Text = "perset(kaoskaki,sepatu,bola)" Then
                TextBox5.Text = 200 * 15 / 100
            Else
                If ComboBox1.Text = "adidas lari" Then
                    TextBox5.Text = 60 * 10 / 100
                End If
            End If
        End If
    End Sub
 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox2.Text = TextBox1.Text / 9000
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox7.Text = TextBox2.Text - TextBox6.Text
    End Sub
   
End Class


Screnshootnya:
(maaf ada kesalahan sedikit)



Demikian penjelasannya misalkan ada kesalahan tolong di beri saran agar saya bisa memperbaikinya,karena saya masih baru belajar.Terima Kasih