Membuat Aplikasi Kasir Restoran Sederhana Melalui Visual Studio 2013
1.Pertama-tama kita akan membuat desain pada aplikasi yang akan kita buat
2.Dilanjutkan dengan mengetikkan Code sebagai berikut :
Public Class Form1
Dim hargaminuman As Single
Dim totalharga As Single
Dim listbeli As Single
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cbominuman.Items.Add("None")
cbominuman.Items.Add("Kopi")
cbominuman.Items.Add("Teh")
cbominuman.Items.Add("Jus")
cbominuman.Items.Add("Anggur Merah")
txtcash.Text = 0
txtnasi.Text = 0
End Sub
Private Sub cbominuman_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbominuman.SelectedIndexChanged
If cbominuman.SelectedIndex = 0 Then hargaminuman = 0
If cbominuman.SelectedIndex = 1 Then hargaminuman = 5000
If cbominuman.SelectedIndex = 2 Then hargaminuman = 4000
If cbominuman.SelectedIndex = 3 Then hargaminuman = 9000
If cbominuman.SelectedIndex = 4 Then hargaminuman = 30000
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If MessageBox.Show("Apakah Anda ingin keluar dari aplikasi restoran ini?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
MessageBox.Show("Thank you for using this application.")
End
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
If cbominuman.Text = "" And Not chkCT.Checked And Not chkWFC.Checked And Not chkAPC.Checked And Not chkBPC.Checked Then
MsgBox("Silakan pilih menu.")
Exit Sub
End If
ListBox1.Items.Add("Terima Kasih atas pesanannya.")
ListBox1.Items.Add("")
ListBox1.Items.Add("Berikut adalah pesanan Anda:")
totalharga = 0
If Txtnasi.Text <> "" Then
totalharga = Txtnasi.Text * 3000
ListBox1.Items.Add("")
ListBox1.Items.Add("Nasi" & " x" & Txtnasi.Text & vbTab & ": " & Txtnasi.Text * 3000)
End If
If chkCT.Checked Or chkWFC.Checked Or chkAPC.Checked Or chkBPC.Checked Then
ListBox1.Items.Add("")
ListBox1.Items.Add("Lauk :")
End If
If chkBPC.Checked Then
totalharga = totalharga + 120000
ListBox1.Items.Add("Black Pepper Crab" & vbTab & ": 120,000")
End If
If chkCTL.Checked Then
totalharga = totalharga + 80000
ListBox1.Items.Add("Crab Tempura" & vbTab & ": 80,000")
End If
If chkAPC.Checked Then
totalharga = totalharga + 80000
ListBox1.Items.Add("Asam Pedas Crab" & vbTab & ": 80,000")
End If
If chkWFC.Checked Then
totalharga = totalharga + 130000
ListBox1.Items.Add("White Pepper Crab" & vbTab & ": 130,000")
End If
If cbominuman.SelectedItem <> "None" Then
ListBox1.Items.Add("")
ListBox1.Items.Add("Minuman :")
If cbominuman.SelectedItem = "Kopi" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Kopi" & vbTab & ": 5,000")
ElseIf cbominuman.SelectedItem = "Teh" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Teh" & vbTab & ": 4,000")
ElseIf cbominuman.SelectedItem = "Jus" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Jus" & vbTab & ": 9,000")
ElseIf cbominuman.SelectedItem = "Anggur Merah" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Anggur" & vbTab & ": 30,000")
End If
End If
ListBox1.Items.Add("")
ListBox1.Items.Add("Total Harga" & vbTab & ": " & totalharga)
End Sub
Private Sub chkCT_CheckedChanged(sender As Object, e As EventArgs) Handles chkCT.CheckedChanged
End Sub
End Class
Dim hargaminuman As Single
Dim totalharga As Single
Dim listbeli As Single
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cbominuman.Items.Add("None")
cbominuman.Items.Add("Kopi")
cbominuman.Items.Add("Teh")
cbominuman.Items.Add("Jus")
cbominuman.Items.Add("Anggur Merah")
txtcash.Text = 0
txtnasi.Text = 0
End Sub
Private Sub cbominuman_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbominuman.SelectedIndexChanged
If cbominuman.SelectedIndex = 0 Then hargaminuman = 0
If cbominuman.SelectedIndex = 1 Then hargaminuman = 5000
If cbominuman.SelectedIndex = 2 Then hargaminuman = 4000
If cbominuman.SelectedIndex = 3 Then hargaminuman = 9000
If cbominuman.SelectedIndex = 4 Then hargaminuman = 30000
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If MessageBox.Show("Apakah Anda ingin keluar dari aplikasi restoran ini?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
MessageBox.Show("Thank you for using this application.")
End
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
If cbominuman.Text = "" And Not chkCT.Checked And Not chkWFC.Checked And Not chkAPC.Checked And Not chkBPC.Checked Then
MsgBox("Silakan pilih menu.")
Exit Sub
End If
ListBox1.Items.Add("Terima Kasih atas pesanannya.")
ListBox1.Items.Add("")
ListBox1.Items.Add("Berikut adalah pesanan Anda:")
totalharga = 0
If Txtnasi.Text <> "" Then
totalharga = Txtnasi.Text * 3000
ListBox1.Items.Add("")
ListBox1.Items.Add("Nasi" & " x" & Txtnasi.Text & vbTab & ": " & Txtnasi.Text * 3000)
End If
If chkCT.Checked Or chkWFC.Checked Or chkAPC.Checked Or chkBPC.Checked Then
ListBox1.Items.Add("")
ListBox1.Items.Add("Lauk :")
End If
If chkBPC.Checked Then
totalharga = totalharga + 120000
ListBox1.Items.Add("Black Pepper Crab" & vbTab & ": 120,000")
End If
If chkCTL.Checked Then
totalharga = totalharga + 80000
ListBox1.Items.Add("Crab Tempura" & vbTab & ": 80,000")
End If
If chkAPC.Checked Then
totalharga = totalharga + 80000
ListBox1.Items.Add("Asam Pedas Crab" & vbTab & ": 80,000")
End If
If chkWFC.Checked Then
totalharga = totalharga + 130000
ListBox1.Items.Add("White Pepper Crab" & vbTab & ": 130,000")
End If
If cbominuman.SelectedItem <> "None" Then
ListBox1.Items.Add("")
ListBox1.Items.Add("Minuman :")
If cbominuman.SelectedItem = "Kopi" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Kopi" & vbTab & ": 5,000")
ElseIf cbominuman.SelectedItem = "Teh" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Teh" & vbTab & ": 4,000")
ElseIf cbominuman.SelectedItem = "Jus" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Jus" & vbTab & ": 9,000")
ElseIf cbominuman.SelectedItem = "Anggur Merah" Then
totalharga = totalharga + hargaminuman
ListBox1.Items.Add("Anggur" & vbTab & ": 30,000")
End If
End If
ListBox1.Items.Add("")
ListBox1.Items.Add("Total Harga" & vbTab & ": " & totalharga)
End Sub
Private Sub chkCT_CheckedChanged(sender As Object, e As EventArgs) Handles chkCT.CheckedChanged
End Sub
End Class
3.Selesai aplikasi kasir sederhana siap diguanakan
Source : Examination Basic Programming
Comments
Post a Comment