visual basic pizza program 1 Follow the StandardsA,B,C document in Course Docume
ID: 3559131 • Letter: V
Question
visual basic pizza program
1
Follow the StandardsA,B,C document in Course Documents Folder
2
Your assignment is to create an application that handles pizza orders
Each order needs to be able to handle multiple orders of pizza / (and soft drinks for extra credit).
3
Give Pizza place a catchy name. Design the form to your liking.
4
Add some color and image(s)
5
Pizza Prices (Small $6:00, Medium $8:00, Large $10.00, Extra Large $12.00)
6
Item Prices (Small Pizza .50, Medium .75, Large 1.00, Extra Large 1.25)
1
Follow the StandardsA,B,C document in Course Documents Folder
2
Your assignment is to create an application that handles pizza orders
Each order needs to be able to handle multiple orders of pizza / (and soft drinks for extra credit).
3
Give Pizza place a catchy name. Design the form to your liking.
4
Add some color and image(s)
5
Pizza Prices (Small $6:00, Medium $8:00, Large $10.00, Extra Large $12.00)
6
Item Prices (Small Pizza .50, Medium .75, Large 1.00, Extra Large 1.25)
Explanation / Answer
Dim pizza As String
Dim top_name As String
Private Sub Form_Load()
'declare array so that the compiler can determine
'the amount of memory space to allocate.
'in this case allocate 10 cells of same sizes
' for 10 toppings
Dim chktop(10) As Integer
End Sub
Private Sub chktop_Click(x As Integer)
Dim tops As Single
'for each topping selectd, add 0.5 to
' a variable called tops
For x = 0 To 9
If chktop(x).Value = 1 Then
tops = tops + 0.5
top_name = chktop(x).Caption
End If
Next x
txttopname.Text = top_name & txttopname.Text
'if no topping selected, then dont display anything
'if 3 or less toppings are selected then price
' of toppings is free. if more than 3 toppings are
'selected, substract the 3 free toppings
If tops = 0 Then
txtTops.Text = ""
ElseIf tops <= 1.5 Then
txtTops.Text = FormatCurrency(0, 2)
Else
txtTops.Text = FormatCurrency(tops - 1.5, 2)
End If
End Sub
Private Sub optLarge_Click()
'i know what it is
If optLarge.Value = True Then
txtPizza.Text = FormatCurrency(15, 2)
pizza = "Large Size"
Else
txtPizza.Text = 0
End If
End Sub
Private Sub optMedium_Click()
'i know what it is
If optMedium.Value = True Then
txtPizza.Text = FormatCurrency(13, 2)
pizza = "Medium Size"
Else
txtPizza.Text = 0
End If
End Sub
Private Sub optSmall_Click()
'i know what it is
If optsmall.Value = True Then
txtPizza.Text = FormatCurrency(10, 2)
pizza = "Small Size"
Else
txtPizza.Text = 0
End If
End Sub
Private Sub cmdAdd_Click()
'declare prices to calculate
Dim pizza_price As Single
Dim tops_price As Single
'make sure pizza size was selected, if it was
'then state price of pizza as variable
If Trim(txtPizza.Text) = "" Then
MsgBox "Error, Choose Pizza Size", vbOKOnly, "Missing"
Exit Sub
Else
pizza_price = txtPizza.Text
End If
'make sure toppings were selected, if they were
'then state price of toppings as variable
If Trim(txtTops.Text) = "" Then
MsgBox "Error, Choose Toppings", vbOKOnly, "Missing"
Exit Sub
Else
tops_price = txtTops.Text
End If
'the total is addition of prices
total = pizza_price + tops_price
'add pizza size to listbox
lstPizza.AddItem pizza
End Sub
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.