Membuat Program Cafe
Private Sub cmdbersih_Click()
menu.Text = ""
paket.Text = ""
listmenu.Clear
deli.Value = False
ditempat.Value = False
harga1.Text = ""
jumbel.Text = ""
totbayar.Text = ""
uangbayar.Text = ""
uangkembali.Text = ""
harga2.Text = ""
End Sub
Private Sub cmdkeluar_Click()
a = MsgBox("Yakin mau keluar?", vbQuestion + vbYesNo, "Pesan")
If a = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Load()
menu.AddItem ("Sarapan Pagi")
menu.AddItem ("Makan Siang")
paket.AddItem ("Paket 1")
paket.AddItem ("Paket 2")
End Sub
Private Sub deli_Click()
harga2 = 5000
jumbel.SetFocus
End Sub
Private Sub ditempat_Click()
harga2 = 0
jumbel.SetFocus
End Sub
Private Sub paket_Click()
If menu.Text = "Sarapan Pagi" Then
listmenu.Clear
If paket.Text = "Paket 1" Then
listmenu.AddItem ("Nasi Uduk")
listmenu.AddItem ("Telur")
listmenu.AddItem ("Tempe Orek")
harga1 = 5000
Else
listmenu.AddItem ("Nasi Goreng")
listmenu.AddItem ("Telur Mata Sapi")
listmenu.AddItem ("Tempe Goreng")
harga1 = 7000
End If
Else
listmenu.Clear
If paket.Text = "Paket 1" Then
listmenu.AddItem ("Nasi Putih")
listmenu.AddItem ("Ayam Bakar")
listmenu.AddItem ("Lalapan")
harga1 = 8000
Else
listmenu.Clear
listmenu.AddItem ("Nasi Putih")
listmenu.AddItem ("Rendang")
listmenu.AddItem ("Sayur")
listmenu.AddItem ("Sambal Ijo")
harga1 = 10000
End If
End If
End Sub
Private Sub jumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
totbayar.Text = Val(jumbel.Text * harga1.Text) + Val(harga2.Text)
uangbayar.SetFocus
End If
End Sub
Private Sub uangbayar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
uangkembali.Text = Val(uangbayar.Text) - Val(totbayar.Text)
If Val(uangbayar.Text) < Val(totbayar.Text) Then
uangkembali = ""
a = MsgBox("Salah, Uang Bayar Lebih Kecil dari Total Bayar", vbQuestion + vbOKOnly, "Pesan")
menu.Text = ""
paket.Text = ""
listmenu.Clear
deli.Value = False
ditempat.Value = False
harga1.Text = ""
jumbel.Text = ""
totbayar.Text = ""
uangbayar.Text = ""
uangkembali.Text = ""
harga2.Text = ""
End Sub
Private Sub cmdkeluar_Click()
a = MsgBox("Yakin mau keluar?", vbQuestion + vbYesNo, "Pesan")
If a = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Load()
menu.AddItem ("Sarapan Pagi")
menu.AddItem ("Makan Siang")
paket.AddItem ("Paket 1")
paket.AddItem ("Paket 2")
End Sub
Private Sub deli_Click()
harga2 = 5000
jumbel.SetFocus
End Sub
Private Sub ditempat_Click()
harga2 = 0
jumbel.SetFocus
End Sub
Private Sub paket_Click()
If menu.Text = "Sarapan Pagi" Then
listmenu.Clear
If paket.Text = "Paket 1" Then
listmenu.AddItem ("Nasi Uduk")
listmenu.AddItem ("Telur")
listmenu.AddItem ("Tempe Orek")
harga1 = 5000
Else
listmenu.AddItem ("Nasi Goreng")
listmenu.AddItem ("Telur Mata Sapi")
listmenu.AddItem ("Tempe Goreng")
harga1 = 7000
End If
Else
listmenu.Clear
If paket.Text = "Paket 1" Then
listmenu.AddItem ("Nasi Putih")
listmenu.AddItem ("Ayam Bakar")
listmenu.AddItem ("Lalapan")
harga1 = 8000
Else
listmenu.Clear
listmenu.AddItem ("Nasi Putih")
listmenu.AddItem ("Rendang")
listmenu.AddItem ("Sayur")
listmenu.AddItem ("Sambal Ijo")
harga1 = 10000
End If
End If
End Sub
Private Sub jumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
totbayar.Text = Val(jumbel.Text * harga1.Text) + Val(harga2.Text)
uangbayar.SetFocus
End If
End Sub
Private Sub uangbayar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
uangkembali.Text = Val(uangbayar.Text) - Val(totbayar.Text)
If Val(uangbayar.Text) < Val(totbayar.Text) Then
uangkembali = ""
a = MsgBox("Salah, Uang Bayar Lebih Kecil dari Total Bayar", vbQuestion + vbOKOnly, "Pesan")
If a = vbOK Then
Unload Me
End If
End If
End If
End Sub
Semoga tugas yang saya posting di blog kesayangan saya ini mendapat nilai yang lumayan yah..Amin,
Dan buat sobat Media Infonetku semoga membantu yah, dan kita bisa sama-sama belajar.
Salam Blogger.
Post a Comment