new to javascript, had an assignment. basically, user enters a product number, my switch statement determines the price, then the user enters a quantity and, and my script is supposed to total everything that is entered. it doesn't do it and i don't know why. not allowed to use arrays. help!!!


PHP Code:

<html>
<
head>
    <
title>Untitled</title>
    <
script type="text/javascript">
        
        var 
productNumber 0;
        var 
p//convert product number to int
        
var quantity;
        var 
q//convert quantity number to int
        
var price;
        var 
pCost 0//price * quantity
        
var totalSum;
        var 
counter 0;
        
        
totalSum 0;
        
//capture number
        
productNumber window.prompt ("Enter product number for an item (1-5), Enter -1 to quit:");
        
        
parseInt(productNumber);

        while (
productNumber != -1)
            {
        
            switch (
p)
                {
                    case 
1price 2.98
                        
quantity window.prompt("Enter quantity sold for product 1:");
                        
parseInt(quantity); 
                        
pCost price q;
                    break;
                    
                    case 
2price 4.50
                        
quantity window.prompt("Enter quantity sold for product 2:");
                        
parseInt(quantity); 
                        
pCost price q;
                    break;
                    
                    case 
3price 9.98
                        
quantity window.prompt("Enter quantity sold for product 3:");
                        
parseInt(quantity); 
                        
pCost price q;
                    break;
                    
                    case 
4price 4.49
                        
quantity window.prompt("Enter quantity sold for product 4:");
                        
parseInt(quantity); 
                        
pCost price q;
                    break;
                    
                    case 
5price 6.87
                        
quantity window.prompt("Enter quantity sold for product 5:");
                        
parseInt(quantity); 
                        
pCost price q;
                    break;
                    
                    default: 
window.alert("Please try again");
                    break;
                
                }
        
counter += 1;
        
totalSum+= parseInt(pCost);
        
productNumber window.prompt ("Enter product number for an item (1-5), Enter -1 to quit:");
        
parseInt(productNumber);
            }
            
    if (
counter !=0)
        {
            
document.writeln("<h1> Total sales for the week : $" totalSum "</h1>");
        }
        else
            {
            
                
window.alert("No product number is entered");
            
            }
        

    
</script>
</head>

<body>


</body>
</html>