Advertisement
veronikaaa86

10. Квартално магазинче

Dec 24th, 2021
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Sub LiveDemo()
  2. Dim result As Double
  3. result = GetIncome("beer", "Sofia", 6)
  4.  
  5. Debug.Print result
  6.  
  7. End Sub
  8.  
  9. Function GetIncome(product As String, town As String, quantity As Double)
  10. If town = "Sofia" Then
  11. If product = "coffee" Then
  12. GetIncome = quantity * 0.5
  13. ElseIf product = "water" Then
  14. GetIncome = quantity * 0.8
  15. ElseIf product = "beer" Then
  16. GetIncome = quantity * 1.2
  17. ElseIf product = "sweets" Then
  18. GetIncome = quantity * 1.45
  19. ElseIf product = "peanuts" Then
  20. GetIncome = quantity * 1.6
  21. End If
  22. ElseIf town = "Plovdiv" Then
  23. If product = "coffee" Then
  24. GetIncome = quantity * 0.4
  25. ElseIf product = "water" Then
  26. GetIncome = quantity * 0.7
  27. ElseIf product = "beer" Then
  28. GetIncome = quantity * 1.15
  29. ElseIf product = "sweets" Then
  30. GetIncome = quantity * 1.3
  31. ElseIf product = "peanuts" Then
  32. GetIncome = quantity * 1.5
  33. End If
  34. ElseIf town = "Varna" Then
  35. If product = "coffee" Then
  36. GetIncome = quantity * 0.45
  37. ElseIf product = "water" Then
  38. GetIncome = quantity * 0.7
  39. ElseIf product = "beer" Then
  40. GetIncome = quantity * 1.1
  41. ElseIf product = "sweets" Then
  42. GetIncome = quantity * 1.35
  43. ElseIf product = "peanuts" Then
  44. GetIncome = quantity * 1.55
  45. End If
  46. End If
  47.  
  48. End Function
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement