Thursday, September 20, 2012

Finished Program w/ Screenshots- Magic 8 Ball



Window 1
Question Box


Public Class frmAsk

Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click
MsgBox("I need somebody. Help, not just anybody. Do you really need help with this? Come on, just press the damn button.")
'Display joke help box
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub

Private Sub btnAsk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAsk.Click
frmAnswer.Show()
'Show other windows form which displays answer form
End Sub
End Class


Window 2
Answer Box
Answer Form
Public Class frmAnswer

Private Sub lblAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblAnswer.Click
End Sub

Private Sub frmAnswer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

lblAnswer.Text = Int(Rnd() * 5 + 1)
'Generate Random integer between 1 and 5

Select Case lblAnswer.Text
Case 1
lblAnswer.Text = "DO I LOOK LIKE A MAGIC 8 BALL PROGRAM TO YOU?"
Case 2
lblAnswer.Text = "Come on, ask a better question."
Case 3
lblAnswer.Text = "As a wise burger once said, eeyup."
Case 4
lblAnswer.Text = "What is a question? A rose by any other- wait..." & vbCrLf & "Uh... No. No to your question."
Case 5
lblAnswer.Text = "Why ask such a question? Alas, humanity has truly produced it's most despicable work."

'Depending on the number generated in the Answer text, display respective answer

Case Else
lblAnswer.Text = "Error"
'If something goes wrong, the Answer text displays error
End Select
End Sub

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

End Sub
End Class

TOE Chart w/ Psuedocode- Magic 8 Ball

Object
Event
Task
Psuedocode
btnAsk
Left mouse button click

Opens new window, frmAnswer

ON Left Mouse Click
LOAD new window
btnExit
Left mouse button click
Ends the program

ON Left Mouse Click
END

btnClose
Left mouse button click
Closes current window, which should be frmAnswer

ON Left Mouse Click
CLOSE frmAnswer
SHOW frmAsk
txtQuestion
Text input
User types in question they want to be answered


lblAnswer
Form load
Generates random answer and shows it in the label

ON form load
Generate random number between 1-5

IF number is 1
DISPLAY
"DO I LOOK LIKE A MAGIC 8 BALL PROGRAM TO YOU?"

IF number is 2
DISPLAY "Come on, ask a better question."

IF number is 3
DISPLAY "As a wise burger once said, eeyup."

IF number is 4
DISPLAY "What is a question? A rose by any other- wait... Uh... No. No to your question."

IF number is 5
DISPLAY "Why ask such a question? Alas, humanity has truly produced it's most despicable work."

Layout Diagram- Magic 8 Ball

The purpose of this program is to simply entertain the user by supplying answers to any question entered. The answers generated are completely random and are not determined by the question asked.

The user enters a question into the text field and clicks the button to generate an answer, which is displayed in a new window.

The designed interface is as it is because it's extremely easy to use by any other person. I chose to make the Magic 8 Ball program as time constraints and bugs with the "Who Wants to Be a Millionare?" programs proved too difficult.

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

TOE Chart w/ Pseudocode- Pizza Ordering System


Object
Event
Task
Psuedocode
txtCustomer
Keyboard
Type in customer’s name

INPUT Customer name
txtAddress
Keyboad
Type in customer’s address

INPUT Customer address
rbtnMag

Left mouse button click, check radio button
Clear other radio button selections

When checked, adds 5 to total price when calculated

rbtnHaw

Left mouse button click, check radio button
Clear other radio button selections

When checked, adds 7 to total price when calculated

rbtnMea

Left mouse button click, check radio button
Clear other radio button selections

When checked, adds 6.5  to total price when calculated

rbtnSup

Left mouse button click, check radio button
Clear other radio button selections

When checked, adds 7.05 to total price when calculated

rbtnVeg

Left mouse button click, check radio button
Clear other radio button selections

When checked, adds 5.5 to total price when calculated

chkAnc

Left mouse button click, check checkbox
When checked, adds 0.95 to total price when calculated

chkChi

Left mouse button click, check checkbox
When checked, adds 1 to total price when calculated

chkOli

Left mouse button click, check checkbox
When checked, adds 0.8 to total price when calculated

chkMus

Left mouse button click, check checkbox
When checked, adds 0.5 to total price when calculated

btnCalc
Left mouse button click, button press
Calculates total price by combining all values

Show total price in lblPrice
IF rbtnMag is selected
ADD 5 to TotalPrice variable

IF rbtnHaw is selected
ADD 7 to TotalPrice variable

IF rbtnMea is selected
ADD 6.5 to TotalPrice variable
IF rbtnSup is selected
ADD 7.05 to TotalPrice variable

IF rbtnVeg is selected
ADD 5.5 to TotalPrice variable

IF chkAnc is selected
ADD 0.95 to TotalPrice variable

IF chkChi is selected
ADD 1 to TotalPrice variable

IF chkOli is selected
ADD 0.8 to TotalPrice variable

IF chkMus is selected
ADD 0.5 to TotalPrice variable


DISPLAY TotalPrice variable in lblPrice
lblPrice

Show Total Price of the order

txtS_Req

Type in any special requests by  customers

btnOrder
Left mouse button click, button press
Join txtCustomer, txtAddress, lblPrice and txtS_Req and show it in a new window
DISPLAY  txtCustomer, txtAddress, lblPrice and txtS_Req
in FORM 2