{"id":1145,"date":"2015-04-06T11:59:58","date_gmt":"2015-04-06T18:59:58","guid":{"rendered":"http:\/\/sites.evergreen.edu\/compcog15\/?page_id=1145"},"modified":"2015-04-06T12:59:59","modified_gmt":"2015-04-06T19:59:59","slug":"change-program","status":"publish","type":"page","link":"https:\/\/sites.evergreen.edu\/compcog15\/classes\/week-2\/april-6\/change-program\/","title":{"rendered":"Change Program"},"content":{"rendered":"<h1 class=\"entry-title\">Change Assignment<\/h1>\n<div class=\"entry-content\">\n<p>In this program you will first successfully run the Change Template Program given to you below.\u00a0 Then, piece by piece you will adapt it so that it prints out the change in dollars, quarters, dimes, nickels and pennies.\u00a0 Your program should look like the following when it runs: (assume first 2 lines are prompt boxes with the underlined values what is entered by the user)<\/p>\n<p><em>Enter purchase price:\u00a0\u00a0 <span style=\"text-decoration: underline\">3.33<br \/>\n<\/span>How much was collected?:\u00a0 <span style=\"text-decoration: underline\">10.00<\/span><\/em><\/p>\n<p><em>The change is:<br \/>\nDollars:\u00a0 6<br \/>\nQuarters:\u00a0\u00a02<br \/>\nDimes:\u00a0 1<br \/>\nNickels: 1<br \/>\nPennies: 2<\/em><\/p>\n<p><em>You can <\/em>add<em> to your program for extra credit the ability to figure sales tax, and the ability to determing $5, $10, and $20 in your change.<\/em><span style=\"text-decoration: underline\"><br \/>\n<\/span><\/p>\n<p>The template can be found at:\u00a0\u00a0 <a href=\"http:\/\/ada.evergreen.edu\/%7Evanetta\/ChangeTemplate.html\">http:\/\/ada.evergreen.edu\/~vanetta\/ChangeTemplate.html<\/a><\/p>\n<p>The HTML is found below.\u00a0 It would be better to cut and paste the source code after successfully running the program above, so you know it works:<\/p>\n<h1>Change Template<\/h1>\n<div>\n<p>&lt;html&gt;<br \/>\n&lt;!\u2013 This program takes the modulus of an input number \u2013&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>&lt;script type=\u201dtext\/javascript\u201d&gt;<br \/>\npurprice = prompt(\u201cEnter amount of purchase\u201d,\u201d\u201d);<br \/>\npurprice = parseFloat(purprice);<\/p>\n<p>collected = prompt(\u201cEnter amount collected by customer\u201d,\u201d\u201d);<br \/>\ncollected = parseFloat(collected);<\/p>\n<p>change = collected \u2013 purprice<br \/>\ndocument.write(\u201camount of change is \u201d + change + \u201c&lt;p&gt;\u201d);<br \/>\nchange = parseInt(change * 100);<br \/>\ndocument.write(\u201cthe number of pennies in your change is \u201d + change + \u201c&lt;p&gt;\u201d);<\/p>\n<p>dollars = parseInt(change \/ 100);<\/p>\n<p>document.write(\u201cthe number of dollars in your change is \u201d + dollars+ \u201c&lt;p&gt;\u201d);<\/p>\n<p>change = change % 100<\/p>\n<p>document.write(\u201cyou still have \u201d + change + \u201d pennies left &lt;p&gt;\u201d);<\/p>\n<p>&lt;\/script&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Change Assignment In this program you will first successfully run the Change Template Program given to you below.\u00a0 Then, piece by piece you will adapt it so that it prints out the change in dollars, quarters, dimes, nickels and pennies.\u00a0 Your program should look like the following when it runs: (assume first 2 lines are [&hellip;]<\/p>\n","protected":false},"author":274,"featured_media":0,"parent":1137,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"_mi_skip_tracking":false},"_links":{"self":[{"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/pages\/1145"}],"collection":[{"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/users\/274"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/comments?post=1145"}],"version-history":[{"count":0,"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/pages\/1145\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/pages\/1137"}],"wp:attachment":[{"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/media?parent=1145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}