Open choongzhanhong opened 11 months ago
I would like to work on it. Could you please describe it more?
I would like to work on it. Could you please describe it more?
Hi friend. Thank you for your comment! In particular, Singapore's bus and train fares are based on distance, there are some tables at the bottom of this page.
There are different prices for Adult, Child, Senior, and so on. I believe there are repetitions in the table too, Bus and DTL/NEL/LRT (Train) fares are identical.
I have not yet determined if there is a formula or pattern, but I believe it can (and should) be hard-coded as a series of if-elseif
blocks.
The fares will be increased on 23 December 2023. So, it would be easier to change the code when time comes.
If you are working on this, could you begin with the adult bus fare calculator as a javascript function that takes in parameter distance in meters? (Distance is calculated in kilometers but to avoid float inaccuracy we can convert to integer)
Should be simple enough, right?