smellykelly
01-27-2010, 09:57 PM
Hi
Iam new here and new to javescript :confused:
ok my problem is i have to try and find out the average of some plant (don't ask )
i have tried everything but still no good, i am sur eit is simple but i am blond :o
anyways here is what i have done so far any help would be great
<HTML>
<HEAD>
<TITLE>
Plant Experiments
</TITLE>
<SCRIPT LANGUAGE = "JavaScript">
/*
* Program to calculate average height of plants..
*
* 20/05/2009
*/
//Experimental results of Table 1 stored in arrays.
var plantHeights = [15,16,17,18,19];
var plantNumbers = [2,1,6,4,2];
//Part (ii).
//Write code to declare and initialise new array to represent the third row of the table.
var avg = new Array(5)
var avg = ["60","80","187","180","114"] ;
avg[0] = "60";
avg[1] = "80";
avg[2] = "187";
avg[3] = "180";
avg[4] = "114";
//Part (iv).
//Write code to calculate the average height of the plants and write it out in the browser window.
Average = avg.length
document.write ("The Average height is: " + Average + "<br>")
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
thanks for taking the time to read my problem and i hope someone can help.
love
kelly
Iam new here and new to javescript :confused:
ok my problem is i have to try and find out the average of some plant (don't ask )
i have tried everything but still no good, i am sur eit is simple but i am blond :o
anyways here is what i have done so far any help would be great
<HTML>
<HEAD>
<TITLE>
Plant Experiments
</TITLE>
<SCRIPT LANGUAGE = "JavaScript">
/*
* Program to calculate average height of plants..
*
* 20/05/2009
*/
//Experimental results of Table 1 stored in arrays.
var plantHeights = [15,16,17,18,19];
var plantNumbers = [2,1,6,4,2];
//Part (ii).
//Write code to declare and initialise new array to represent the third row of the table.
var avg = new Array(5)
var avg = ["60","80","187","180","114"] ;
avg[0] = "60";
avg[1] = "80";
avg[2] = "187";
avg[3] = "180";
avg[4] = "114";
//Part (iv).
//Write code to calculate the average height of the plants and write it out in the browser window.
Average = avg.length
document.write ("The Average height is: " + Average + "<br>")
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
thanks for taking the time to read my problem and i hope someone can help.
love
kelly