i have 3 scripts bellow that i just cant seem to get work any help = much love (ps i have the appropriate html so i know its not that)

var num = []

for (var counter=1;counter<=5;counter++)
{
var num = prompt("Enter a number value here");
num = parseInt(num);
arr.push(num);
}


for (var counter=0; counter<num.length; counter++)
{
var cubedNum = cube(num[index]);

document.write("<br>" + num[index] + " cubed is " + cubedNum)
}

var average = average(num);
document.write("and not forgetting the average is " + average);
}

function cube(x)
{
var cubed = x * x * x;
return cubed;


function average(arr)
{
var total = 0;
for (var counter = 0; counter<5; counter++)
{
total+=arr[counter];
}
average = total / 5;

return average;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//doesnt produce alert
var floor = ["Beech", "Maple", "Tile", "Laminate"];
var price = [25, 30, 20, 10];
//arrays

function calculate()
{
var length = document.getElementById("length");
var width = document.getElementById("width");
var radioOperator = document.querySelector('input[type=radio]:checked');
var index = radioOperator.value;

if(validateText(length)==false)
{
return;
}

if(validateText(width)==false)
{
return;
}

length = parseFloat(length.value);
width = parseFloat(width.value);

var area = length * width;
var packs = (area / 2);
packs = Math.ceil(packs);
var wholeCost = packs * price[index];

alert("\n The flooring type chosen was " + floor[index] + "." +
"\n The area had a length of " + length + " meters and width of " + width + "meters." +
"\nTotal room area is: " + area.toFixed(2) + " square meters. " +
"\nYou are going to require " + numpacks + " packs at the price of \u00A3" + price[index].toFixed(2) + " per pack." +
"\nThe total flooring cost is \u00A3" + wholeCost + ".");

}
//calculate cost and display answer plus validation

function validateText(textbox)
{
if(textbox.value=="")
{
alert("Please enter a number for Length and width");
textbox.focus();
return false;
}
else if(isNaN(textbox.value))
{
alert("Text box does not contain a number");
textbox.value="";
textbox.focus();
return false;
}
else if(textbox.value<=0 || textbox.value>50)
{
alert("Number must be between 1 and 50");
textbox.value="";
textbox.focus();
return false;
}
return true;
}

//validation function

document.getElementById("calculate").addEventListener('click', calculate);
// event that listens for the click of the calculate button
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Item titles
var items = ["Beech", "Maple", "Tile","laminate"];
//Item prices
var prices = [0.4, 1.2, 0.8];

//Array to hold Items
var shoppingList = new Array();

function Item() {
this.item="No description";
this.price=0;
this.length=0;
this.width=0;

}

function calculate(){
displaySummary.innerHTML="";//clear summary paragraph
var quantity=document.getElementById("length");
var quantity=document.getElementById("width");
//validate quantity
quantity=parseFloat(length.value);
quantity=parseInt(width.value);

addItemToShoppingList(length, width);
clearForm();
}

function addItemToShoppingList(length,width){

//Find out which radio button is selected
var radioOperator = document.querySelector('input[type=radio]:checked');
var index=radioOperator.value;

//Create item and add to shopping list
var i = new Item();
i.item = items[index];
i.price = prices[index];
i.length = length;
i.width = width;
//Add current item to the array
shoppingList.push(i);

//Calculate total for current item
var total = (i.price * (i.width * i.length)) / 2;
var total = Math.ceil

alert("Current item: " + "\nType: " + i.item +
"\nPrice: \u00A3" + i.price +
"\nLength: " + i.length +
"\nWidth: " + i.width +
"\nTotal: \u00A3" + total.toFixed(2)
);
}

function clearForm(){
document.getElementsByName("floor")[0].checked=true;
document.getElementById("length").value="";
document.getElementById("width").value="";

}

function showSummary(){
if (shoppingList.length==0){
alert("No items to display");
return;
}
displaySummary.innerHTML="";

for (var index=0;index<shoppingList.length;index++){
var item = shoppingList[index].item;
var price = shoppingList[index].price;
var length = shoppingList[index].length;
var width = shoppingList[index].width;


displaySummary.innerHTML+="Item: " + item;
displaySummary.innerHTML+="<br>Price: &pound;" + price;
displaySummary.innerHTML+="<br>Length: " + length;
displaySummary.innerHTML+="<br>Width: " + width;


var total = (i.price * (i.width * i.length)) / 2;
displaySummary.innerHTML+="<br>Total: &pound;" + total.toFixed(2);
displaySummary.innerHTML+="<br>";
}
showTotals();
}

function showTotals(){
var totalForItem = [0,0,0,0];//Totals for Baked Beans, Pasta and Soup
displaySummary.innerHTML+= "<br>Transactions for type";
for (var index=0;index<shoppingList.length;index++){
var item = shoppingList[index].item;
if(item=="Beech"){
totalForItem[0]++;
}
else if(item=="Maple"){
totalForItem[1]++;
}
else if(item=="Tile"){
totalForItem[2]++;
}
else(item=="Laminate"){
totalForItem[3]++;
}

}

for (var index=0;index<totalForItem.length;index++){
displaySummary.innerHTML+= "<br>" + items[index] + " " + totalForItem[index];
}
}

document.getElementById("calc").addEventListener('click',calculate);
document.getElementById("summary").addEventListener('click',showSummary);

////spent last week and abit on it and has be in by 20th arh!!!!!!! i suck at java script