OK so I have a simple fare I have to compute. There is a start zone and an end zone. There are 3 separate zones so 9 different charges. Plus there are charges for minutes too 0-4, 4-10, 10-20 and 20 to no limit. The user will input 3 parameters the start and end zone and the time. This would be a JS file. HELP

I am just trying to see how to start this and I know I need nested if then statements.

Paul_Wilkins
—
2011-06-02T04:34:28Z —
#2

Will it always be only 3 inputs that are made?Will a form that consists of only a start, end, and time fields (as well as possibly a result area) be enough?Can you provide an example of how the start/end zone will be used to calculate the fare.

mrhoo
—
2011-06-02T04:59:35Z —
#3

There is no 'nested if then' statement in javascript.

Paul_Wilkins
—
2011-06-02T05:01:22Z —
#4

mrhoo said:

There is no 'nested if then' statement in javascript.

He may not know the correct words with which to impart that which he is meaning.

whteout
—
2011-06-02T23:33:33Z —
#5

yes sorry i meant nested if else statements.

Example would be start 1 end 1 and 10 minutes or start 1 end 2 and 5 minutes would be your inputs.

Paul_Wilkins
—
2011-06-02T23:36:06Z —
#6

whteout said:

Example would be start 1 end 1 and 10 minutes or start 1 end 2 and 5 minutes would be your inputs.

What effect do the zones have on the charges, and how do the minutes factor in to things?

whteout
—
2011-06-02T23:53:25Z —
#7

each example of a start and end has a price. time is split into 15 minute intervals and increase in price. so 1 to 1 is $5 and 14 minutes is $5 so your fare is $10

Paul_Wilkins
—
2011-06-03T00:30:32Z —
#8

whteout said:

each example of a start and end has a price. time is split into 15 minute intervals and increase in price. so 1 to 1 is $5 and 14 minutes is $5 so your fare is $10

So when going from zone 1 to zone 2 you add up both the charges for each zone plus the minutes?

What about when going from zone 1 to 3? Do you add all three zone charges together for that?

Paul_Wilkins
—
2011-06-03T00:51:06Z —
#9

What I envisage is to use a config array, so that you can easily control how the prices are charged:

With zoneCharge, zone 1 is $5, zone 2 is $10, and so on.With timeGroups, that's the number of minutes before which the appropriate charge is addedAnd with timeCharge, that's the cost at the appropriate number of minutes.

So with the 14 minutes being less than 20, a charge of $5 applies for that.

I already have a working sample of the form. The purpose of these questions is to narrow down on how you intend for it to be used.

sorry you have 3 zones. you ask the user for a start and an end zone. there are only 3 zones. so they start in 1 and end in 2 and that is a price. you start in 2 and end in 3 and that is a price. So there are 9 total choices. Then you have to ask the user for the amount of time it took and that is broken into 15 minute increments.

Paul_Wilkins
—
2011-06-03T01:06:46Z —
#11

whteout said:

sorry you have 3 zones. you ask the user for a start and an end zone. there are only 3 zones. so they start in 1 and end in 2 and that is a price. you start in 2 and end in 3 and that is a price. So there are 9 total choices. Then you have to ask the user for the amount of time it took and that is broken into 15 minute increments.

That seems to differ from what was initially stated.0-4, 4-10, 10-20 and 20 to no limit

When you have the specs nailed down, we can then advise you on the most appropriate techniques to use.