Monday, July 26, 2010

BMTC Bus Ticket Cost Calculation

In a recent travel through BMTC bus to my office, I was involved in a big fight between another software engineer and the bus conductor on - how the ticket price was calculated? The software engineer did not know Kannada and the bus conductor could explain in the English. I served as the translator in that heated argument :)... here is the info how the ticket price is calculated.

Note: The calculation is performed by the ticketing machine given to the bus conductor so the conductor cannot cheat you!

BMTC divides the routes into stages. Following is the 'Fare Table' of BMTC Bus No 45. You can get the 'Fare Table' for your route from the conductor....Please Ask!













FARE TABLE-010
StageNameFare
1KAMAKYA0.00
2KATTRIGUPPE5.00
3HOSAKERE HALLI9.00
4BANK COLONY10.00
5GANESH BHAVAN13.00
6CHAMARAJPET15.00
7GOODS ROAD16.00
8KBS16.00


Now the stage you climb the bus is the Stage 1 for you and of course the stage you get off is the last stage for you. Lets see the following examples of fare calculation with the previous assumption.

Fare from

  • KAMAKYA to KBS = Stage 8 - Stage 0 = 8 Stages crossed = Rs 16
  • BANK COLONY to GOODS Road = Stage 7 - Stage 4 = 3 Stages Crossed = Rs 9
  • GOODS ROAD to KBS = Stage 8 - Stage 7 = 1 Stage crossed = Rs 5
Algorithmically,


List stageList=[KAMKYA...KBS]
List fareList=[0..16]
int start= stageList.indexOf[YOUR START STAGE]
int end = stageList.indexOf[YOUR END STAGE]
Fare= fareList[end-start]

Hope the calculation is clear!

2 comments:

G i G said...

kool....bejaan sati confusion aagittu edu...eega clear ...thanks...for the post

G i G said...

kool....bejaan sati confusion aagittu edu...eega clear ...thanks...for the post