Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub LiveDemo()
- Dim result As Double
- result = GetIncome("beer", "Sofia", 6)
- Debug.Print result
- End Sub
- Function GetIncome(product As String, town As String, quantity As Double)
- If town = "Sofia" Then
- If product = "coffee" Then
- GetIncome = quantity * 0.5
- ElseIf product = "water" Then
- GetIncome = quantity * 0.8
- ElseIf product = "beer" Then
- GetIncome = quantity * 1.2
- ElseIf product = "sweets" Then
- GetIncome = quantity * 1.45
- ElseIf product = "peanuts" Then
- GetIncome = quantity * 1.6
- End If
- ElseIf town = "Plovdiv" Then
- If product = "coffee" Then
- GetIncome = quantity * 0.4
- ElseIf product = "water" Then
- GetIncome = quantity * 0.7
- ElseIf product = "beer" Then
- GetIncome = quantity * 1.15
- ElseIf product = "sweets" Then
- GetIncome = quantity * 1.3
- ElseIf product = "peanuts" Then
- GetIncome = quantity * 1.5
- End If
- ElseIf town = "Varna" Then
- If product = "coffee" Then
- GetIncome = quantity * 0.45
- ElseIf product = "water" Then
- GetIncome = quantity * 0.7
- ElseIf product = "beer" Then
- GetIncome = quantity * 1.1
- ElseIf product = "sweets" Then
- GetIncome = quantity * 1.35
- ElseIf product = "peanuts" Then
- GetIncome = quantity * 1.55
- End If
- End If
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement