Professional Documents
Culture Documents
End Sub
min = 10000
max = 0
count = 0
While count < 10
count = count + 1
Console.WriteLine("enter price")
Prices = Console.ReadLine
End While
average = total / 10
Return average
End Function
last = Right(ItemID, 4)
If IsNumeric(last) = False Then
valid = False
End If
remaining = Mid(ItemID, 4, 2)
If remaining <> LCase(remaining) Then
valid = False
End If
Return valid
'note: this is a simple solution but if you use nested if else it would be more
efficient
End Function
Sub ApplyDiscount(ItemId As String)
Dim TodayDate As Date
Dim category As String
Dim DiscountedPrice As Decimal
'Price is global, hardcode a price to execute in vb
TodayDate = Now()
Dim ID As Char
ID = Right(ItemId, 1)
Select Case ID
Case "7"
category = "Decor"
DiscountedPrice = Price - Price * 10 / 100
Case "8"
category = "Stationery"
DiscountedPrice = Price - Price * 20 / 100
Case "9"
category = "Dairy"
DiscountedPrice = Price - Price * 15 / 100
Case Else
Console.WriteLine("Invalid ItemId")
End Select
End Sub
Sub Main()
Dim ItemID As String
Dim result As Boolean
Call INPUT(ItemID)
result = Validate(ItemID)
Console.ReadKey()
End Sub