I am receiving a NaN
error when I run this code. I've been trying to find out why for a while now and can't for the life of me.
To clarify, I am trying to receive;
the total amount owed by customers
how many customers are entered
function Summarise() { ID = prompt("Enter a Customer ID number ", -1) while(ID != -1) { var gasUsed = 0 var total = 0 gasUsed = prompt("Enter amount of gas used ", "0") ///Standard Rate is used to assist in the calculation of customers in excess of 60 Gas Used StandardRate = 60 * 1.75 if(gasUsed <= 60) { total= gasUsed * 2 document.write("Customers ID: " + ID) document.write(" has gas usage of " + gasUsed) document.write(" and owes $" + total) document.write("<br/>") } else { total= (gasUsed - 60) * 1.50 + StandardRate document.write("Customers ID: " + ID) document.write(" has gas usage of " + gasUsed) document.write(" and owes $" + total) document.write("<br/>") } var totalowed = total + totalowed var totalcustomers = ++totalcustomers ID = prompt("Enter a Customer ID number ", -1) } document.write("Total amount owed $" + totalowed) document.write("<br/>") document.write("Total Number of customers:" + totalcustomers) }