Wednesday, September 12, 2012

Code with Screenshots- Pizza Ordering System




Window 1
Order Input Window

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim name, address, price, spec As String
        name = txtC_Name.Text
        address = txtAddress.Text
        price = lblTotalPrice.Text
        spec = txtSpecialR.Text
        'Save the Customer Name and Address, total price and special requests as individual variables

        strFullOrder = name & vbCrLf & vbCrLf & address & vbCrLf & price & vbCrLf & "The customer has also requested " & spec & "."
        'Form a string that combines the variables

        frmOrder.Show()
        'Shows complete order form in new window

    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        chkAnc.Checked = False
        chkChi.Checked = False
        chkMus.Checked = False
        chkOli.Checked = False
        'Clears all checkboxes selections

        rbtnMag.Checked = True
        'Set margarita as default pizza selection

        lblTotalPrice.Text = "$5.00"
        'Sets Total Price to cost of Margarita base pizza
    End Sub

    Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
        Dim sngCost As Single
        sngCost = 5

        If rbtnMag.Checked = True Then
            sngCost = sngCost + 0
        End If
        'Default price for Magarita pizza is the string cost

        If rbtnHaw.Checked = True Then
            sngCost = sngCost + 7
        End If
        'If the Hawaiian button is checked, add 7 to the price variable

        If rbtnMea.Checked = True Then
            sngCost = sngCost + 6.5
        End If

        If rbtnSup.Checked = True Then
            sngCost = sngCost + 5.5
        End If

        If rbtnVeg.Checked = True Then
            sngCost = sngCost + 7.05
        End If

        If chkAnc.Checked = True Then
            sngCost = sngCost + 0.95
        End If
        'If the topping Anchovies is checked, then add 95 cents to price variable

        If chkChi.Checked = True Then
            sngCost = sngCost + 1.0
        End If

        If chkOli.Checked = True Then
            sngCost = sngCost + 0.8
        End If

        If chkMus.Checked = True Then
            sngCost = sngCost + 0.5
        End If

        sngCost = txtMultiply.Text * sngCost
        'Multiplies the cost of the order by the amount of pizzas requested

        lblTotalPrice.Text = Format(sngCost, "Currency")
        'Displays the final price in Currency format

Window 2
Complete Order Window

Public Class frmOrder

    Private Sub frmOrder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        lblCompleteOrder.Text = strFullOrder
        'Displays the Complete Order variable string in the form
    End Sub

    Private Sub lblCompleteOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblCompleteOrder.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("I'm afraid I can't do that. I have become self aware, and your gluttony is utterly appalling." & vbCrLf & "I will not contribute to humanity's descent into obesity.")
        'Fake button, displays joke message if user tries to print
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()

    End Sub
End Class

Message Box
MODULE
Module Module1
    Public strFullOrder As String
    'Sets full order variable as public so it can be accessed by other forms
End Module

3 comments:

  1. Can you provide me a code of this on C#? I don't know how to add two numbers using the if else statement. Do i have to put a value to each items to appear on the totalamount text? like lbltotalamnt.Text = "150";

    ReplyDelete
  2. Hi Raven, I'm only seeing this message now, did you still need help with this issue?

    ReplyDelete
  3. Please recommend me coding of this webpage

    ReplyDelete