Calculate Button
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Perform the following commands when the
‘Calculate’ button is clicked…
Dim sngCost
As Single
sngCost = 8
Defines the single cost as $8
If
chkJalapeno.Checked = True Then
sngCost = sngCost + 1.0
End If
If ‘Jalapeno Pepper’ is checked add $1
to the single cost
If
chkChillie.Checked = True Then
sngCost = sngCost + 0.8
End If
If ‘Chillies and Spices’ is checked
add 80c to the single cost
If
chkPrawns.Checked = True Then
sngCost = sngCost + 1.0
End If
If ‘Prawns’ is checked add $1 to the
single cost
If chkCheese.Checked
= True Then
sngCost = sngCost + 0.5
End If
If ‘Extra Cheese’ is checked add 50c
to the single cost
If
nbrPizza.Text = "" Then
nbrPizza.Text = 1
End If
If the ‘number of pizzas’ is blank, change it so the
number "1" appears in the 'Numeric Up and Down' and calculate the price as for 1 pizza.
sngCost = txtNumber.Text * sngCost
Defines the total cost as ‘total single cost (after the toppings were added) multiplied by the number
of pizzas ordered’.
lblPrice.Text = Format(sngCost, "Currency")
Gives the total cost in currency format and displays it in the 'total price' label
Clear Button
Private Sub
btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnClear.Click
Complete
the following action when the ‘Clear’ button is clicked…
rbnHot.Checked = True
Check
‘Hot and Spicy’ from the pizza flavours menu
chkJalapeno.Checked = False
If ‘Jalapeno Pepper’ is checked, uncheck it
chkChillie.Checked = False
If ‘Chillies and Spices’ is checked, uncheck it
chkPrawns.Checked = False
If ‘Prawns’ is checked, uncheck it
chkCheese.Checked = False
If ‘Extra Cheese’ is checked, uncheck it
txtNumber.Text = 1
Set
the default number of pizzas to 1
lblPrice.Text = "$0.00"
Set
the default price to $0.00
~PsudoCode Complete~
No comments:
Post a Comment