Click to See Complete Forum and Search --> : Way to add nubmers in a form
Deckard45
05-25-2005, 07:36 PM
Hi. I'm trying to find a way to add up numbers in a form. Its for a taxi site i'm doing for a friend. The customer will pick how many people are travelling from a drop down list or check box (maximum of 7 people) and the total will be calculated and displayed in a box. Thanks for any help
buntine
05-25-2005, 09:15 PM
The calculations really depend on the charge of the taxi service. It may be a static charge per kilometer, person, etc. Or it may increase or decrease depending on other factors.
I will assume the cost is static.
private static final double TAXI_FARE = 7.60;
public double calcFare(int passengers)
{
return (TAXI_FARE * passengers);
}
Regards.
Note, this is the Java forum. So, I assume your referring to JSP and not JavaScript.
Deckard45
05-26-2005, 04:51 AM
Thanks. Yeah sorry I was refering to Java script for Frontpage
Deckard45
05-26-2005, 04:54 AM
I can see now I posted this in the wrong Forum, sorry guys. Was about 3 in the morning when I posted it, was a bit tired. I'll post it in the java script section.
buntine
05-26-2005, 06:28 AM
Thats alright. ;)