0% found this document useful (0 votes)
29 views2 pages

Jollibee Cart Management System

The JollibeeCart class manages a menu of Jollibee items with their prices and allows users to add or remove items from a cart. It updates the total price dynamically and processes checkout by confirming orders or warning if the cart is empty. The class includes event handlers for button clicks to facilitate the addition and removal of items.

Uploaded by

allenbnvtra.11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Jollibee Cart Management System

The JollibeeCart class manages a menu of Jollibee items with their prices and allows users to add or remove items from a cart. It updates the total price dynamically and processes checkout by confirming orders or warning if the cart is empty. The class includes event handlers for button clicks to facilitate the addition and removal of items.

Uploaded by

allenbnvtra.11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Public Class JollibeeCart

Dim menuItems As New Dictionary(Of String, Integer) From {


{"Jolly Spaghetti", 60},
{"Yumburger", 50},
{"Jolly Hotdog", 70},
{"Chickenjoy 1pc", 99},
{"Chickenjoy 2pc", 190},
{"Jolly Burger Steak", 80},
{"Jolly Fries", 45},
{"Jolly Sundae", 40},
{"Burger Steak Family", 320},
{"Jollibee Bucket", 599}
}

Dim totalPrice As Integer = 0

Private Sub JollibeeCart_Load(sender As Object, e As EventArgs) Handles


[Link]
[Link] = "Total: 0 Php"
End Sub

Private Sub AddToCart(item As String, price As Integer)


[Link](item & " - " & price & " Php")
totalPrice += price
UpdateTotalPrice()
End Sub

Private Sub UpdateTotalPrice()


[Link] = "Total: " & totalPrice & " Php"
End Sub

Private Sub RemoveSelectedItem()


If [Link] <> -1 Then
Dim selectedItem As String = [Link]()
Dim itemPrice As Integer = CInt([Link]("-"c)(1).Replace("
Php", "").Trim())
totalPrice -= itemPrice
[Link]([Link])
UpdateTotalPrice()
End If
End Sub

Private Sub ProcessCheckout()


If [Link] > 0 Then
[Link]("Your Jollibee order is confirmed!", "Checkout",
[Link], [Link])
[Link]()
totalPrice = 0
UpdateTotalPrice()
Else
[Link]("Your cart is empty!", "Warning", [Link],
[Link])
End If
End Sub

Private Sub BtnAdd1_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Jolly Spaghetti", 60)
End Sub
Private Sub BtnAdd2_Click(sender As Object, e As EventArgs) Handles
[Link]
AddToCart("Yumburger", 50)
End Sub

Private Sub BtnAdd3_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Jolly Hotdog", 70)
End Sub

Private Sub BtnAdd4_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Chickenjoy 1pc", 99)
End Sub

Private Sub BtnAdd5_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Chickenjoy 2pc", 190)
End Sub

Private Sub BtnAdd6_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Jolly Burger Steak", 80)
End Sub

Private Sub BtnAdd7_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Jolly Fries", 45)
End Sub

Private Sub BtnAdd8_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Jolly Sundae", 40)
End Sub

Private Sub BtnAdd9_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Burger Steak Family", 320)
End Sub

Private Sub BtnAdd10_Click(sender As Object, e As EventArgs) Handles


[Link]
AddToCart("Jollibee Bucket", 599)
End Sub

Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles


[Link]
RemoveSelectedItem()
End Sub

Private Sub BtnCheckout_Click(sender As Object, e As EventArgs) Handles


[Link]
ProcessCheckout()
End Sub
End Class

You might also like