Alright I need some direction here....
I'm making a program that displays the balance of the three items with the input of the user input quantity.
one it cost 1.75
second cost 2.00
and 3rd cost 1.25
I need to use a sub, a function and another sub , i've tried to make a program on my own but i'm quite stuck...
this is what I tried first...
Public Class frmRestaurant
Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
'Declares the variables and their value
Dim pizza, fries, drinks, As Double
GetNumbers(pizza, fries, drinks)
displayPrices(pizza, fries, drinks)
Dim fmtBill As String = "{0,-21}{1,-10}{2,-12}"
lstBill.Items.Clear()
lstBill.Items.Add(String.Format(fmtBill, "Item", "Quantity", "Prices"))
lstBill.Items.Add("")
End Sub
Sub GetNumbers(ByRef pizza As Double, ByRef fries As Double, ByRef drinks As Double)
' Gets the numbers in the txt boxes
pizza = CDbl(TxtPizza.Text)
fries = CDbl(txtFries.Text)
drinks = CDbl(txtDrinks.Text)
End Sub
Sub displayPrices(ByVal pizza As Double, ByVal fries As Double, ByVal drinks As Double)
Dim balance As Double
balance = ItemSum(pizza, fries, drinks)
lstBill.Items.Add(balance)
End Sub
Function ItemSum(ByRef num1 As Double, ByRef num2 As Double, ByRef num3 As Double)
Dim sum As Double
num1 = pizza * 1.75
num2 = fries * 2.0
num3 = drinks * 1.25
sum = num1 + num2 + num3
Return sum
End Function
End Class


