I'm working on a coffee shop project for my teacher that has 3 different forms and a module I thought I was done when she told me to. Declare an "AddToOrder" sub procedure to keep a running subtotal of regular and/or decaf coffee ordered. I then started to decipher what that means I think I have the codes to do it but their in the wrong spots if anyone could just look at what I have and tell me what I need to do that be helpful. I declared the ADD TO ORDER sub procedure in my module. I don't know what goes in it but the purpose of it to keep track of the amount of coffee bought. You see I have a 2 different forms with 2 different list boxes to order coffee from that display messages on how much coffee you bought by selecting from the decaf or regular list boxes. This is what I have so far I'm not asking you to do my homework at all I just need to know what has to go into my AddToOrder sub procedure. Any help I'd appreciate it.
Module Module2
Public intFirst As Integer = 10
Public intSecond As Integer = 18
Public intThird As Integer = 85
Public intOne As Integer = 8
Public intTwo As Integer = 15
Public intTen As Integer = 70
Public Const dblTAXRATE As Double = 0.07
Public g_Total As Double
Public Function CalcTax(ByVal cost As Decimal) As Double
' This function calculates and returns the
' sales tax on ticket sales. The ticket cost is
' passed as an argument.
Return cost * dblTAXRATE
End Function
Public Sub AddToOrder()
g_Total += intFirst
g_Total += intSecond
g_Total += intThird
g_Total += intOne
g_Total += intTwo
g_Total += intTen
End Sub
End Module
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
'Adds pounds together
If lstSize.SelectedIndex = -1 Then
MsgBox("Select a Size", MsgBoxStyle.Critical)
Else
Select Case CStr(lstSize.SelectedIndex)
Case CStr(0)
g_Total += intOne * nudOrder.Value
MessageBox.Show(CStr("Current SubTotal is $") & g_Total, "SubTotal", MessageBoxButtons.OK, MessageBoxIcon.Question)
Case CStr(1)
g_Total += intTwo * nudOrder.Value
MessageBox.Show(CStr("Current SubTotal is $") & g_Total, "SubTotal", MessageBoxButtons.OK, MessageBoxIcon.Question)
Case CStr(2)
g_Total += intTen * nudOrder.Value
MessageBox.Show(CStr("Current SubTotal is $") & g_Total, "SubTotal", MessageBoxButtons.OK, MessageBoxIcon.Question)
End Select
End If
End Sub
Private Sub btnOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOrder.Click
'Retains the price of the coffee you order
If lstPounds.SelectedIndex = -1 Then
MsgBox("Select a Size", MsgBoxStyle.Critical)
Else
Select Case CStr(lstPounds.SelectedIndex)
Case CStr(0)
g_Total += intFirst * nudQuantity.Value
MessageBox.Show(CStr("Current SubTotal is $") & g_Total, "SubTotal", MessageBoxButtons.OK, MessageBoxIcon.Question)
Case CStr(1)
g_Total += intSecond * nudQuantity.Value
MessageBox.Show(CStr("Current SubTotal is $") & g_Total, "SubTotal", MessageBoxButtons.OK, MessageBoxIcon.Question)
Case CStr(2)
g_Total += intThird * nudQuantity.Value
MessageBox.Show(CStr("Current SubTotal is $") & g_Total, "SubTotal", MessageBoxButtons.OK, MessageBoxIcon.Question)
End Select
End If
End Sub