
Phil L. answered 10/17/13
Tutor
0
(0)
BI professional specializing in Excel, Access, VBA and SQL
Public Function DiskOrderPrice(intQuantity As Integer, strType As String)
Dim intNumOrdered As Integer, strGBSize As String, dbDiscount As Double, intPrice As Double
strGBSize = strType
intNumOrdered = intQuantity
'Get discount rate
If intNumOrdered < 25 Then
dbDiscount = 0
ElseIf intNumOrdered > 25 Then
If intNumOrdered < 50 Then
dbDiscount = 0.1
ElseIf intNumOrdered > 49 Then
If intNumOrdered < 100 Then
dbDiscount = 0.15
Else
dbDiscount = 0.2
End If
End If
End If
'assuming on 8 or 12 GB
If strGBSize = "8 GB" Then
intPrice = 3.3
Else
intPrice = 5.2
End If
discount = ((intNumOrdered * intPrice) * dbDiscount)
DiskOrderPrice = (intNumOrdered * intPrice)
finalPrice = DiskOrderPrice - discount
End Function
Dim intNumOrdered As Integer, strGBSize As String, dbDiscount As Double, intPrice As Double
strGBSize = strType
intNumOrdered = intQuantity
'Get discount rate
If intNumOrdered < 25 Then
dbDiscount = 0
ElseIf intNumOrdered > 25 Then
If intNumOrdered < 50 Then
dbDiscount = 0.1
ElseIf intNumOrdered > 49 Then
If intNumOrdered < 100 Then
dbDiscount = 0.15
Else
dbDiscount = 0.2
End If
End If
End If
'assuming on 8 or 12 GB
If strGBSize = "8 GB" Then
intPrice = 3.3
Else
intPrice = 5.2
End If
discount = ((intNumOrdered * intPrice) * dbDiscount)
DiskOrderPrice = (intNumOrdered * intPrice)
finalPrice = DiskOrderPrice - discount
End Function