Kahuki Webmaster Forum  

Go Back   Kahuki Webmaster Forum > Website Development & Management > Programming > JavaScript

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-16-2007, 07:11 PM
Member
 
Join Date: Jan 2007
Posts: 67
classic is on a distinguished road
Arrow I need a equation

I need to do a physics equation using javascript it needs to use the array variable and it needs to contain 10 differnt equations. I need a equation that looks something like this

5(kg) * 10 (m/s^2) = 50 (N)

Reply With Quote
  #2 (permalink)  
Old 05-16-2007, 09:45 PM
Rookie
 
Join Date: May 2007
Posts: 1
petros is on a distinguished road
I'm not exactly sure what you are asking for (other than I am sure it's a homework assignment).

If you mean you want to compute force, here's a simple JavaScript for that:

<script type="text/javascript">
function computeForce(mass, accel) {
//computes newtons of force from mass and accelleration inputs

var newtons = 0;
if(NaN(mass) || NaN(accel)) {
alert('Bad parameters, try again.');
return false;
}
else {
newtons = mass * accel;
return newtons;
}
}

var mass = 5; //mass in kg
var accel = 9.8 //accelleration in m/s^2
var output = 'The force in Newtons of a ' + mass + 'kg mass at an accelleration of ' + accel + 'm/s^2 is ' + computeForce(mass, accel) + '.';
document.write(output);
</script>

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How is Google PR Calculated ? I have the equation but I am no sure if it is right !!! jeff Google 3 01-04-2008 11:32 PM
Hiphop=sex+drugs+money+hoes...(wrong equation..!)? chatchai General Discussions 5 07-06-2006 08:36 PM


All times are GMT. The time now is 04:46 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0