Hello all.
I have a formula that calculates a price based on the number of miles.
Here is the formula:
For the first 1 mile - charge £19 flat rate
For the next 29 miles - charge £1.50 for every 1 mile
For the next 20 miles - charge £1.25 for every 1 mile
For the rest - charge £1.00 for every 1 mile
Here are some valid results for testing:
1 mile = £19
5 miles = £25
10 miles = £32.50
20 miles = £47.50
50 miles = £87.50
100 miles = £137.50
I think this can be acheived using a Select Case.
I have tried the following:
But already I'm stuck (Expected ')' on bold line..
I'm not sure if this is the best way to go about things (logically)...
Really could use some assistance.
Thanks
I have a formula that calculates a price based on the number of miles.
Here is the formula:
For the first 1 mile - charge £19 flat rate
For the next 29 miles - charge £1.50 for every 1 mile
For the next 20 miles - charge £1.25 for every 1 mile
For the rest - charge £1.00 for every 1 mile
Here are some valid results for testing:
1 mile = £19
5 miles = £25
10 miles = £32.50
20 miles = £47.50
50 miles = £87.50
100 miles = £137.50
I think this can be acheived using a Select Case.
I have tried the following:
Code:
<%
Mileage = 10
[b]Sub GetPrice(ByVal Mileage As Integer)[/b]
Select Case Mileage
Case Is <=1
Price = 19
Case Is 1 To 30
Price = 19 + ((Mileage - 1) * 1.50)
End Select
End Sub
Response.Write Price
%>
But already I'm stuck (Expected ')' on bold line..
I'm not sure if this is the best way to go about things (logically)...
Really could use some assistance.
Thanks