On Jan 10, 4:46 pm, Rossko <[email protected]> wrote:
> > If you look in the code it calculates the price by 1+6 for each mile.
> > How would I make it so that it is £5 for the first 2 miles then £3 for
> > each mile after that?
>
> That's got nothing to do with maps.

Indeed, but it's fun to work out.

If the distance in miles is x, I reckon the answer is
d = Math.ceil(x); // always round up to the next whole mile
price = Math.min(d,2)*5+Math.max(d-2,0)*3

x=0.75; d=1; price = 1*5+0*3 = 5
x=2.5; d=3; price = 2*5 + 1*3 = 13

You could omit the rounding up step if you were feeling virtuous.

Andrew
-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.


Reply via email to