Senin, 08 Maret 2010

Program Sour Sally

Pada program ini, pertama kali harus mengklik tombol mulai, setelah itu semua tombol akan berfungsi.









Setelah itu, masukkan jumlah toping yang diinginkan.


Tahap terakhir, masukkan topping yang diinginkan. setelah itu klik tombol beli dan akan keluar harga, diskon yang di dapat dan jumlah yang harus dibayarkan.


Diskon hanya berlaku bagu pembelian dengan 3 topping. diskon 10% dari harga.














Source code:


Public Class Form1


Private Sub mulai_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mulai.Click

rb1.Enabled = True

rb2.Enabled = True

rb3.Enabled = True

rb1.Checked = False

rb2.Checked = False

rb3.Checked = False

harga.Enabled = False

diskon.Enabled = False

total.Enabled = False

top1.Text = ""

top2.Text = ""

top3.Text = ""


harga.Text = ""

diskon.Text = ""

total.Text = ""

If mulai.Text = "MULAI" Then

mulai.Text = "REFRESH"

Else

mulai.Text = "MULAI"

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 rb1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rb1.CheckedChanged

top1.Visible = True

top2.Visible = False

top3.Visible = False

Label2.Visible = True

Label3.Visible = False

Label4.Visible = False

top1.Text = ""

top2.Text = ""

top3.Text = ""

End Sub


Private Sub rb2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rb2.CheckedChanged

top1.Visible = True

top2.Visible = True

top3.Visible = False

Label2.Visible = True

Label3.Visible = True

Label4.Visible = False

top1.Text = ""

top2.Text = ""

top3.Text = ""

End Sub

Private Sub rb3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rb3.CheckedChanged

top1.Visible = True

top2.Visible = True

top3.Visible = True

Label2.Visible = True

Label3.Visible = True

Label4.Visible = True

top1.Text = ""

top2.Text = ""

top3.Text = ""

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If rb1.Checked = True Then

If top1.Text = "" Then

MsgBox("Isi dulu mau toping apa", MsgBoxStyle.Exclamation, "No Toping")

Exit Sub

End If

harga.Enabled = True

harga.Text = "15000"

diskon.Enabled = True

diskon.Text = "0"

ElseIf rb2.Checked = True Then

If top1.Text & top2.Text = "" Then

MsgBox("Isi dulu mau toping apa", MsgBoxStyle.Exclamation, "No Toping")

Exit Sub

ElseIf top1.Text = "" Then

MsgBox("Toping kurang 1", MsgBoxStyle.Exclamation, "Toping kurang 1")

Exit Sub

ElseIf top2.Text = "" Then

MsgBox("Toping kurang 1", MsgBoxStyle.Exclamation, "Toping kurang 1")

Exit Sub

End If

harga.Enabled = True

harga.Text = "25000"

diskon.Enabled = True

diskon.Text = "0"

ElseIf rb3.Checked = True Then

If top1.Text & top2.Text & top3.Text = "" Then

MsgBox("Isi dulu mau toping apa", MsgBoxStyle.Exclamation, "No Toping")

Exit Sub

ElseIf top2.Text & top3.Text = "" Then

MsgBox("Toping kurang 2", MsgBoxStyle.Exclamation, "Toping kurang 2")

Exit Sub

ElseIf top1.Text & top3.Text = "" Then

MsgBox("Toping kurang 2", MsgBoxStyle.Exclamation, "Toping kurang 2")

Exit Sub

ElseIf top1.Text & top2.Text = "" Then

MsgBox("Toping kurang 2", MsgBoxStyle.Exclamation, "Toping kurang 2")

Exit Sub

ElseIf top1.Text = "" Then

MsgBox("Toping kurang 1", MsgBoxStyle.Exclamation, "Toping kurang 1")

Exit Sub

ElseIf top2.Text = "" Then

MsgBox("Toping kurang 1", MsgBoxStyle.Exclamation, "Toping kurang 1")

Exit Sub

ElseIf top3.Text = "" Then

MsgBox("Toping kurang 1", MsgBoxStyle.Exclamation, "Toping kurang 1")

Exit Sub

End If

harga.Enabled = True

harga.Text = "30000"

diskon.Enabled = True

diskon.Text = Val(harga.Text) * 0.1

Else

MsgBox("Belum ada pilihan toping !", MsgBoxStyle.Information, "Belum ada pilihan toping")

End If

total.Enabled = True

total.Text = harga.Text - diskon.Text

End Sub

End Class