madison Posted December 16, 2011 Posted December 16, 2011 Hi, Not sure if anyone out there can assist. I am trying to create a taxi fare calculator using google maps to calculate the route between two points, the mileage and then the price. So far (and with help) I have been able to get it working but I am struggling with the various options that need to be accounted for when calculating a fare. I need to use several if else statements so that if a customer wants a price for 3 people at 10am they are given the standard taxi day rate but, if they want to have 5 people in the day it uses a 'bus rate'. Similarly, both rates are then subject to a night time tariff! So, my question is, is it possible to use this many variables using the if else statement or do I need to find another way of doing it. Thanks.
germ Posted December 16, 2011 Posted December 16, 2011 If you have more than 2 possibilities a "switch" usually works better (IMHO). The ever popular "if ... else..." works great for dealing with two possible situations. If you have much more than that it leaves a lot to be desired. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.