{"id":2138,"date":"2016-04-20T10:34:00","date_gmt":"2016-04-20T17:34:00","guid":{"rendered":"https:\/\/sites.evergreen.edu\/candc16\/?page_id=2138"},"modified":"2016-04-20T10:34:00","modified_gmt":"2016-04-20T17:34:00","slug":"write-code-example-2","status":"publish","type":"page","link":"https:\/\/sites.evergreen.edu\/compcog17\/write-code-example-2\/","title":{"rendered":"Write Code Example"},"content":{"rendered":"<div class=\"post-header\">\n<h1 class=\"post-title\">Write Code Example Problem<\/h1>\n<\/div>\n<div class=\"post-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<\/div>\n<p>WRITE THE ENGLISH BEFORE THE CODE<\/p>\n<div class=\"post-content\">\n<p>GET A SCORE<br \/>\nWHILE THE SCORE IS LESS THAN 100<br \/>\n&#8212; \u00a0IF THE SCORE IS LESS THAN 60 AND THE SCORE IS EVEN<br \/>\n&#8212;&#8212;&#8212; \u00a0OUTPUT SCORE IS LESS THAN 60 AND EVEN<br \/>\n&#8212;&#8212;&#8212;- \u00a0 GET THE NAME FROM THE PERSON<br \/>\n&#8212; \u00a0IF THE SCORE IS ODD AND GREATER THAN 80<br \/>\n&#8212;&#8212;&#8212; COUNT IT<br \/>\n&#8212; \u00a0IF SCORE IS LESS THAN 70<br \/>\n&#8212;&#8212;&#8212; IF SCORE IS THE HIGHEST SO FAR<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; USE THIS SCORE AS THE NEW HIGHEST<br \/>\n&#8212; \u00a0IF THE TEST SCORE IS IN THE 80S<br \/>\n&#8212;&#8212;&#8212;- COUNT IT<br \/>\n&#8212;&#8212;&#8212;&#8211;SUM IT<br \/>\n&#8212; \u00a0GET NEXT TEST SCORE<\/p>\n<\/div>\n<p>PRINT THE NUMBER OF ODD SCORES OVER 80<br \/>\nPRINT THE HIGHEST SCORE LESS THAN 70<br \/>\nPRINT THE AVERAGE OF ALL SCORES IN THE 80S<\/p>\n<p>&nbsp;<\/p>\n<p>CODE: \u00a0Comes directly from ENGLISH above! \u00a0THINK in ENGLISH, then translate<\/p>\n<div class=\"post-content\">\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\u201d + \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<\/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":"closed","template":"","meta":{"_mi_skip_tracking":false},"_links":{"self":[{"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/pages\/2138"}],"collection":[{"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/users\/274"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/comments?post=2138"}],"version-history":[{"count":0,"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/pages\/2138\/revisions"}],"wp:attachment":[{"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/media?parent=2138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}