Professional Documents
Culture Documents
TUTORIAL 6-9 Building The Bagel House Application
TUTORIAL 6-9 Building The Bagel House Application
2. Set up the form as shown in Figure 6-21. Refer to Figure 6-20 and Table 6-1 for
specific details about the controls and their properties.
3. Table 6-1 Bagel and Coffee Calculator controls and properties:
4. Once you have placed all the controls on the form and set their properties, you can
begin writing the code. Start by opening the Code window and writing the class-level
declarations shown:
Return decBagel
End Function
Return decCostOfTopping
End Function
Return decCoffee
End Function
Sub ResetBagels()
' This procedure resets the bagel selection.
radWhite.Checked = True
End Sub
Sub ResetToppings()
' This procedure resets the topping selection.
chkCreamCheese.Checked = False
chkButter.Checked = False
chkBlueberry.Checked = False
chkRaspberry.Checked = False
chkPeach.Checked = False
End Sub
Sub ResetCoffee()
' This procedure resets the coffee selection.
radRegCoffee.Checked = True
End Sub
Sub ResetPrice()
' This procedure resets the price.
lblSubtotal.Text = String.Empty
lblTax.Text = String.Empty
lblTotal.Text = String.Empty
End Sub
7. Save and run the program. If there are errors, use debugging techniques you have
learned to find and correct them.
8. When you are sure the application is running correctly, save it one last time.
9. Coding:
lblSubtotal.Text = decSubtotal.ToString("c")
lblTax.Text = decTax.ToString("c")
lblTotal.Text = decTotal.ToString("c")
End Sub
Return decBagel
End Function
Return decCostofTopping
End Function
Sub ResetBagels()
' This procedure resets the bagel selection.
radWhite.Checked = True
End Sub
Sub ResetToppings()
' This procedure resets the topping selection.
chkCreamCheese.Checked = False
chkButter.Checked = False
chkBlueberry.Checked = False
chkRaspberry.Checked = False
chkPeach.Checked = False
End Sub
Sub ResetCoffee()
' This procedure resets the coffee selection.
radRegCoffee.Checked = True
End Sub
Sub ResetPrice()
' This procedure resets the price.
lblSubtotal.Text = String.Empty
lblTax.Text = String.Empty
lblTotal.Text = String.Empty
End Sub
10. Output: