Informasi Penjualan Produk
--------------------------------------------------
No Kode Produk Harga Jumlah Total
--------------------------------------------------
1 1 TV 2000000 1 4000000
2 2 DVD 650000 2 1300000
3 2 DVD 650000 1 650000
4 1 TV 2000000 3 6000000
5 3 CD ROOM 450000 2 900000
--------------------------------------------------
Ketentuan agar hasil output seperti di atas yaitu
Jika Kode=1 maka Produknya TV seharga 2000000
Jika Kode=2 maka Produknya DVD seharga 650000
Jika Kode=3 maka Produknya CD ROOM seharga 450000
Nah dari kasus di atas, silahkan anda buat program agar bisa menghasilkan output seperti tersebut.
Hasil program yang diharapkan seperti gambar di bawah ini :
Tampilan Output
Berikut Jawaban Program :
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LV.Columns.Add("Kode", 80, HorizontalAlignment.Left)
LV.Columns.Add("Produk", 80, HorizontalAlignment.Left)
LV.Columns.Add("Harga", 80, HorizontalAlignment.Left)
LV.Columns.Add("Jumlah", 80, HorizontalAlignment.Left)
LV.Columns.Add("Total ", 80, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
Kode.Items.Add("1")
Kode.Items.Add("2")
Kode.Items.Add("3")
End Sub
Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
If Kode.Text = "1" Then
Produk.Text = "TV"
Harga.Text = "2000000"
ElseIf Kode.Text = "2" Then
Produk.Text = "DVD"
Harga.Text = "650000"
ElseIf Kode.Text = "3" Then
Produk.Text = "CD ROOM"
Harga.Text = "650000"
End If
End Sub
Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
Total.Text = Val(Harga.Text) * Val(Jumlah.Text)
Dim lst As New ListViewItem
lst.Text = Kode.Text
lst.SubItems.Add(Produk.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(Jumlah.Text)
lst.SubItems.Add(Total.Text)
LV.Items.Add(lst)
End Sub
Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
Me.Close()
End Sub
Private Sub Btnbatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbatal.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub Btnlist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnlist.Click
LV.Items.Clear()
End Sub
End Class
Demikianlah Postingan saya:
Nama : Joe Perdo B. Nababan
Npm : 14110440
Kelas : TI.P-1404
Tidak ada komentar:
Posting Komentar