Change Template

<html>
 <!– This program takes the modulus of an input number –>

 <body>

   <script type=”text/javascript”>
     purprice = prompt(“Enter amount of purchase”,””);
     purprice = parseFloat(purprice);

     collected = prompt(“Enter amount collected by customer”,””);
     collected = parseFloat(collected);

     change = collected – purprice
     document.write(“amount of change is ” + change + “<p>”);
     change = parseInt(change * 100);
     document.write(“the number of pennies in your change is ” + change + “<p>”);

     dollars = parseInt(change / 100);

     document.write(“the number of dollars in your change is ” + dollars+ “<p>”);

     change = change % 100

     document.write(“you still have ” + change + ” pennies left <p>”);
  
   </script>
 </body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>