0

Hello,

I am supposed to write a program that prompts user to enter the numbers separated by space and when user click "ok" button, it should display the numbers entered with its mean, and standard deviation and the window should ask if user wants to enter numbers again if yes then it should display the new numbers entered, with its mean and standard deviation.

I created an external javascript file and embedded inside the strict XHTML file

here is what I got :-

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Calculator</title>
<script type="text/javascript" src="mean.js"></script>
</head>
<body>
<p>This page calculates mean and standard deviation</p>
</body>
<script type="text/javascript">
var n=new Array();
</script>
</html>
```

I decide to write MeanCalculation function and standardDevationCalculation function and NUmberReader function

My NumberReader function is

```
function NumberReader()
{
var i;
this.n = prompt("Enter a list of numbers separated by spaces:", "").split(" ");
for(i=0;i<this.n.length;i++)
{
document.write("<br />["+i+"] = "+this.n[i]);
}
}
```

Is this function correct?

I need help in writing mean function

```
function meanCalculation()
{
var i;
var sum;
var mean;
for(int i = 0; i<this.n.length;i++)
{
```

thanks,