{"id":1437,"date":"2015-05-12T13:47:23","date_gmt":"2015-05-12T20:47:23","guid":{"rendered":"http:\/\/sites.evergreen.edu\/compcog15\/?page_id=1437"},"modified":"2015-05-12T13:48:57","modified_gmt":"2015-05-12T20:48:57","slug":"write-code-example","status":"publish","type":"page","link":"https:\/\/sites.evergreen.edu\/compcog15\/write-code-example\/","title":{"rendered":"Write Code Example"},"content":{"rendered":"<header class=\"entry-header\">\n<h1 class=\"entry-title\">Write Code Example Problem<\/h1>\n<\/header>\n<div class=\"entry-content\">\n<p>Write a program to get scores from a user until a test score 100 or higher is entered. \u00a0If an even score less than 60 is entered, tell the user this fact and get the name of that student. \u00a0After the loop is exited, find the number of odd scores over 80, the highest score less than 70,and the average score in the 80s<\/p>\n<p>ANSWER IS BELOW<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;html&gt;<br \/>\n&lt;body&gt;<\/p>\n<p>&lt;script type=\u201dtext\/javascript\u201d&gt;<\/p>\n<p>var eventotal = evencount = highodd = eightycount = 0;<\/p>\n<p>testscore = prompt(\u201center the first test score\u201d,\u201d\u201d);<br \/>\ntestscore = parseInt(testscore);<br \/>\nwhile (testscore &lt; 100 )<br \/>\n{<br \/>\nif ((testscore&lt; 60) &amp;&amp; (testscore%2 == 0))<br \/>\n{<br \/>\ndocument.write(\u201cthis even score is less than 60\u2033 + \u201c&lt;p&gt;\u201d);<br \/>\nname = prompt(\u201cwhat is this persons name?\u201d,\u201d\u201d);<br \/>\n}<\/p>\n<p>if ((testscore % 2) == 1) &amp;&amp; (testscore &gt; 80) )<br \/>\n{<br \/>\ncount = count + 1;<br \/>\n}<\/p>\n<p>if (testscore &lt; 70)<br \/>\n{<br \/>\nif (testscore&gt;high)<br \/>\n{<br \/>\nhigh = testscore;<br \/>\n}<br \/>\n}<\/p>\n<p>if ((testscore &gt; 79) &amp;&amp; (testscore &lt; 90))<br \/>\n{<br \/>\nec = ec + 1;<br \/>\nesum = esum + testscore;<br \/>\n}<\/p>\n<p>testscore = prompt(\u201center the next test score or 0 to exit\u201d,\u201d\u201d);<br \/>\ntestscore = parseInt(testscore);<br \/>\n}<\/p>\n<p>document.write(\u201cthe number of odd scores over 80 is \u201d + count + \u201c&lt;p&gt;\u201d);<br \/>\ndocument.write(\u201cthe highest score less than 70 is \u201d + high + \u201c&lt;p&gt;\u201d);<br \/>\ndocument.write(\u201cthe average score in the 80s is \u201d + esum\/ec + \u201c&lt;p&gt;\u201d);<\/p>\n<p>&lt;\/script&gt;<\/p>\n<p>&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Write Code Example Problem Write a program to get scores from a user until a test score 100 or higher is entered. \u00a0If an even score less than 60 is entered, tell the user this fact and get the name of that student. \u00a0After the loop is exited, find the number of odd scores over [&hellip;]<\/p>\n","protected":false},"author":274,"featured_media":0,"parent":0,"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\/1437"}],"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=1437"}],"version-history":[{"count":0,"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/pages\/1437\/revisions"}],"wp:attachment":[{"href":"https:\/\/sites.evergreen.edu\/compcog15\/wp-json\/wp\/v2\/media?parent=1437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}