/    Sign up×
Community /Pin to ProfileBookmark

CAN someone turn this into Java????

Can someone help turn this into to java for my web site?

0.0336 * W * (mph upper ^2) – 0.0336 * W * (mph lower ^2) = torque

torque / acc time/550 = horsepower acc

torque / dec time/550 = horsepower dec

horsepower acc + horsepower dec = horsepower

user definable inputs are:

W = weight
Mph upper
Mph lower
Acc time
Dec time

Calculation to determine vehicle horsepower
Eg:
Car weight + driver = 1800 pounds
Mph lower = 50
Mph upper = 70
Acc time (time to get from 50 to 70) 5 seconds
Dec time (time to get from 70 to 50 in neutral) = 10 seconds

0.0336* 1800 * (70 ^2) – 0.0336* 1800 * (50 ^2) =

60.48 * 4900 – 60.48 * 2500 =
296352 – 151200 = 145152

torque / acc time/550 = horsepower acc
145152 / 5 / 550 = 52.78

torque / dec time/550 = horsepower dec

145152 / 10 / 550 26.39

52.78 + 26.39 = 79.17 final horsepower

The bits that need to be seen are the user definable inputs and the final horsepower.
All else can take place behind the scenes.

Any help greatly appreciated

Cheers
Josh

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@AdamBrillAug 06.2003 — Take a look at this:<html>
<head>
<title>Mouse position</title>
<script type="text/javascript">
function get_horsepower(W, mph_upper, mph_lower, acc_time, dec_time){
torque = 0.0336 * W * (mph_upper*mph_upper) - 0.0336 * W * (mph_lower*mph_lower);
horsepower_acc = torque / acc_time/550;
horsepower_dec = torque / dec_time/550;
return (horsepower_acc + horsepower_dec);
}

<i> </i>alert(get_horsepower(1800, 70, 50, 5, 10));

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form&gt;
Weight: &lt;input type=text name="weight"&gt;&lt;br&gt;
MPH Upper: &lt;input type=text name="mph_upper"&gt;&lt;br&gt;
MPH Lower: &lt;input type=text name="mph_lower"&gt;&lt;br&gt;
ACC Time: &lt;input type=text name="acc_time"&gt;&lt;br&gt;
DEC Time: &lt;input type=text name="dec_time"&gt;&lt;br&gt;
&lt;input type=button value="Calculate HorsePower" onclick="this.form.horsepower.value=get_horsepower(this.form.weight.value,this.form.mph_upper.value,this.form.mph_lower.value,this.form.acc_time.value,this.form.dec_time.value);"&gt;&lt;br&gt;
Total Horsepower: &lt;input type=text name="horsepower"&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@Josh_bauthorAug 06.2003 — cheers for that, sorry to sound stupid but do i just copy and paste the code to my pages code? dont i have to do some enable java type code that goes befor the code you wrote?
Copy linkTweet thisAlerts:
@Josh_bauthorAug 06.2003 — hhe i think i have sussed it its fantastic!

I MUST LEARN IT!

i use front page, i need to suss out how to in corperate it into an existing page
×

Success!

Help @Josh_b 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 5.17,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...