/    Sign up×
Community /Pin to ProfileBookmark

Way to add nubmers in a form

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

to post a comment
Java

4 Comments(s)

Copy linkTweet thisAlerts:
@buntineMay 26.2005 — 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.
<i>
</i>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.
Copy linkTweet thisAlerts:
@Deckard45authorMay 26.2005 — Thanks. Yeah sorry I was refering to Java script for Frontpage
Copy linkTweet thisAlerts:
@Deckard45authorMay 26.2005 — 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.
Copy linkTweet thisAlerts:
@buntineMay 26.2005 — Thats alright. ?
×

Success!

Help @Deckard45 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...