Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9 percent of $5000, or a total of $650. Write a script (using an array of counters) that obtains the gross sales for each employee through an XHTML form and determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer amount):
A. $200–299
B. $300–399
C. $400–499
D. $500–599
E. $600–699
F. $700–799
G. $800–899
H. $900–999
I. $1000 and over

<?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>
<head>
<title>SalesPay</title>
<script type="text/javascript">
<!--
function calculate()
{
var i=0; var j;
var s = prompt("Enter Gross Sales of an Employee (Exit: -1):", "");
var gross = parseInt(s);
var sal_btwn = [0,0,0,0,0,0,0,0,0,0,0];
while (gross != -1)
{
var income = new Array();
var salary = 200.0 + Math.round(0.09*gross);
income[i]=salary;
document.writeln("The Gross sales made by salesperson in a week is $ ", +gross);
document.write("<br />");
document.writeln("Salesperson's Commission is $", +income[i]);
document.write("<br />");
if (income[i] >= 200 && income[i] <= 299)
{
//alert(income[i]);
//alert(sal_btwn[0]);
sal_btwn[2] += 1;
}
if (income[i]>= 300 && income[i]<= 399)
sal_btwn[3] += 1;
if (income[i]>= 400 && income[i] <= 499)
sal_btwn[4] += 1;
if (income[i] >= 500 && income[i] <= 599)
sal_btwn[5] += 1;
if (income[i] >= 600 && income[i] <= 699)
sal_btwn[6] += 1;
if (income[i] >= 700 && income[i] <= 799)
sal_btwn[7] += 1;
if (income[i] >= 800 && income[i] <= 899)
sal_btwn[8] += 1;
if (income[i] >= 900 && income[i] <= 999)
sal_btwn[9] += 1;
if (income[i] >= 1000)
sal_btwn[10] += 1;
document.write("<br />");
i++;
var s = prompt("Enter Gross Sales of an Employee (Exit: -1):", "");
var gross = parseInt(s);
}
document.writeln("<h4>Number of sales people earned salaries in each of the following ranges:</h4>");
document.writeln("$200-$299 : " +sal_btwn[2]);
document.write("<br />");
document.writeln("$300-$399 : " +sal_btwn[3]);
document.write("<br />");
document.writeln("$400-$499 : " +sal_btwn[4]);
document.write("<br />");
document.writeln("$500-$599 : " +sal_btwn[5]);
document.write("<br />");
document.writeln("$600-$699 : " +sal_btwn[6]);
document.write("<br />");
document.writeln("$700-$799 : " +sal_btwn[7]);
document.write("<br />");
document.writeln("$800-$899 : " +sal_btwn[8]);
document.write("<br />");
document.writeln("$900-$999 : " +sal_btwn[9]);
document.write("<br />");
document.writeln(" over$1000 : " +sal_btwn[10]);
}
// -->
</script>
</head>
<body onload="calculate()">
<h1>SalesPay</h1>
<hr />

<p>Press F5 or Refresh to load script again.</p>

</body>
</html>