Kahuki Webmaster Forum  

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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-10-2007, 07:08 PM
Member
 
Join Date: Feb 2007
Posts: 61
Mozart is on a distinguished road
Help!!!!!

This is the question that I do not get

2) The physics equation for Force, F = m*a. (3pt)
Means force (N) is equals to mass (kg) times by acceleration (m/s^2)
...Use an array to store 10 masses and another array to store 10 accelerations.
...Use a loop to calculate and output (document.write) the forces generated.
Sample output: 5(kg) * 10 (m/s^2) = 50 (N)


help pls

Reply With Quote
  #2 (permalink)  
Old 05-10-2007, 07:12 PM
Sky Sky is offline
Rookie
 
Join Date: Jun 2007
Posts: 6
Sky is on a distinguished road
Huh? Use a frickin nerd to do this!

Reply With Quote
  #3 (permalink)  
Old 05-11-2007, 08:09 AM
svennie's Avatar
Rookie
 
Join Date: Apr 2007
Posts: 5
svennie is on a distinguished road
If I’ve understood the question properly then you need to create two arrays, one to hold the mass and one to hold the acceleration. Then you iterate through the arrays and multiply one element by the other to obtain the force.

I’m not too sure if each mass element has to by multiplied by each of the acceleration elements in turn, in which case you’ll need a second iteration. But I’ll assume that you don’t, so the answer should look something like this:


var mass = new Array(5,10,15,20,25,30,35,40,45,50);

var acc = new Array(10,20,30,40,50,60,70,80,90,100);

for (var i=0; i <10; i++) {

var force = mass[i] * acc[i];

document.writeln(force);

}

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


All times are GMT. The time now is 04:08 PM.


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