VERSION 5.00 Begin VB.Form frmPizzaOrder Caption = "Pizza Order" ClientHeight = 3840 ClientLeft = 3492 ClientTop = 2424 ClientWidth = 5628 LinkTopic = "Form1" ScaleHeight = 3840 ScaleWidth = 5628 Begin VB.CommandButton cmdDone Caption = "Done" Height = 372 Left = 4440 TabIndex = 12 Top = 840 Width = 972 End Begin VB.CommandButton cmdPrint Caption = "Print" Height = 372 Left = 4440 TabIndex = 11 Top = 360 Width = 972 End Begin VB.CheckBox chkOnions Caption = "Onions" Height = 252 Left = 2640 TabIndex = 8 Top = 2640 Width = 972 End Begin VB.CheckBox chkHotPeppers Caption = "Hot peppers" Height = 252 Left = 2640 TabIndex = 7 Top = 2280 Width = 1452 End Begin VB.CheckBox chkPepperoni Caption = "Pepperoni" Height = 252 Left = 840 TabIndex = 6 Top = 2640 Width = 1332 End Begin VB.CheckBox chkMushrooms Caption = "Mushrooms" Height = 252 Left = 840 TabIndex = 5 Top = 2280 Width = 1332 End Begin VB.Frame fraPizzaSize Caption = "Pizza size" Height = 732 Left = 360 TabIndex = 1 Top = 840 Width = 3492 Begin VB.OptionButton optLarge Caption = "Large" Height = 252 Left = 2040 TabIndex = 3 Top = 360 Width = 972 End Begin VB.OptionButton optRegular Caption = "Regular" Height = 252 Left = 600 TabIndex = 2 Top = 360 Width = 1092 End End Begin VB.Label lblOrder Caption = "Order number:" Height = 252 Left = 360 TabIndex = 0 Top = 360 Width = 1092 End Begin VB.Label lblOrderNumber Height = 252 Left = 1560 TabIndex = 13 Top = 360 Width = 372 End Begin VB.Label lblTotalPrice Height = 252 Left = 1680 TabIndex = 10 Top = 3240 Width = 612 End Begin VB.Label lblTotal Caption = "Total Price = $" Height = 252 Left = 360 TabIndex = 9 Top = 3240 Width = 1212 End Begin VB.Label lblToppings Caption = "Toppings:" Height = 252 Left = 360 TabIndex = 4 Top = 1920 Width = 972 End End Attribute VB_Name = "frmPizzaOrder" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False ' Chapter 5 Pizza Order Case Study ' 3/99 Option Explicit Private Const curRegularPizzaPrice As Currency = 7 Private Const curLargePizzaPrice As Currency = 10 Private Const curMushroomPrice As Currency = 0.75 Private Const curPepperoniPrice As Currency = 0.75 Private Const curOnionPrice As Currency = 0.75 Private Const curHotPepperPrice As Currency = 0.75 Private intOrderNumber As Integer Private curToppingsPrice As Currency Private curPizzaPrice As Currency Private Sub Form_Load() intOrderNumber = 1 lblOrderNumber.Caption = intOrderNumber optLarge.Value = False optRegular.Value = True curPizzaPrice = curRegularPizzaPrice chkPepperoni.Value = vbUnchecked chkMushrooms.Value = vbUnchecked chkOnions.Value = vbUnchecked chkHotPeppers.Value = vbUnchecked curToppingsPrice = 0 lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub optRegular_Click() curPizzaPrice = curRegularPizzaPrice lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub optLarge_Click() curPizzaPrice = curLargePizzaPrice lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub chkMushrooms_Click() If chkMushrooms.Value = vbChecked Then curToppingsPrice = curToppingsPrice + curMushroomPrice Else curToppingsPrice = curToppingsPrice - curMushroomPrice End If lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub chkHotPeppers_Click() If chkHotPeppers.Value = vbChecked Then curToppingsPrice = curToppingsPrice + curHotPepperPrice Else curToppingsPrice = curToppingsPrice - curHotPepperPrice End If lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub chkPepperoni_Click() If chkPepperoni.Value = vbChecked Then curToppingsPrice = curToppingsPrice + curPepperoniPrice Else curToppingsPrice = curToppingsPrice - curPepperoniPrice End If lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub chkOnions_Click() If chkOnions.Value = vbChecked Then curToppingsPrice = curToppingsPrice + curOnionPrice Else curToppingsPrice = curToppingsPrice - curOnionPrice End If lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub cmdPrint_Click() frmPizzaOrder.PrintForm MsgBox "Order printed. Ready for next order." intOrderNumber = intOrderNumber + 1 lblOrderNumber.Caption = intOrderNumber optLarge.Value = False optRegular.Value = True curPizzaPrice = curRegularPizzaPrice chkPepperoni.Value = vbUnchecked chkMushrooms.Value = vbUnchecked chkOnions.Value = vbUnchecked chkHotPeppers.Value = vbUnchecked curToppingsPrice = 0 lblTotalPrice.Caption = curPizzaPrice + curToppingsPrice End Sub Private Sub cmdDone_Click() Unload Me End Sub