title: In JavaScript doing a simple shipping and handling calculation
body: <p>I am having trouble with a simple JavaScript calculation. My document is supposed to add $1.50 to an order if it is $25 or less, or add 10% of the order if it is more then $25. The exact problem is: </p>
  
  <p>Many companies normally charge a shipping and handling charge for purchases. Create a Web page that allows a user to enter a purchase price into a text box and includes a JavaScript function that calculates shipping and handling. Add functionality to the script that adds a minimum shipping and handling charge of $1.50 for any purchase that is less than or equal to $25.00. For any orders over $25.00, add 10% to the total purchase price for shipping and handling, but do not include the $1.50 minimum shipping and handling charge. The formula for calculating a percentage is price * percent / 100. For example, the formula for calculating 10% of a $50.00 purchase price is 50 * 10 / 100, which results in a shipping and handling charge of $5.00. After you determine the total cost of the order (purchase plus shipping and handling), display it in an alert dialog box.</p>
  
  <p>This is my code:</p>
  
  <pre><code>    var price = window.prompt("What is the purchase price?", 0);
  var shipping = calculateShipping(price);
  var total = price + shipping;
  function calculateShipping(price){
  if (price &lt;= 25){
   return 1.5;
  }
  else{
   return price * 10 / 100
  }
  }
  window.alert("Your total is $" + total + ".");
  </code></pre>
  
  <p>When testing I enter a number in the prompt box, and instead of calculating as if I entered a number it calculates as if I entered a string. i.e. i enter 19 and it gives me 191.5 or I enter 26 and it gives me 262.6</p>