{"id":808,"date":"2014-04-23T22:40:04","date_gmt":"2014-04-23T22:40:04","guid":{"rendered":"http:\/\/blogs.evergreen.edu\/candc14\/?page_id=808"},"modified":"2017-05-31T21:25:47","modified_gmt":"2017-06-01T04:25:47","slug":"write-code-example","status":"publish","type":"page","link":"https:\/\/sites.evergreen.edu\/compcog17\/communications-2\/forums\/classes\/april-26\/write-code-example\/","title":{"rendered":"Write Code Example"},"content":{"rendered":"<h1>Write Code #1<\/h1>\n<div>\n<h2><strong>Problem:\u00a0\u00a0<\/strong><br \/>\n<strong>Write a program to get test scores from the user until a 0 test score is entered. For each test, tell if it is below 50. \u00a0After you finish getting all the scores, print out the average of all the even scores, the highest odd score, and the number of scores in the 80s.<\/strong><\/h2>\n<h2><strong>SOLUTION:<\/strong><\/h2>\n<p><strong>get a test score<\/strong><br \/>\n<strong>while there are still tests left<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0 if it is below 50<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tell the user it is below 50<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0 if this score is even<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 add this test score to the total for even test scores<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 add 1 to the count of even scores<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0 if this score is odd<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if this is the highest odd score so far<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 change the high odd score to this score<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0 if this score is greater that 79 and less than 90<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 add 1 to the count for scores in the 80s<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0 get the next score<\/strong><br \/>\n<strong>print the total of even scores divided by the count of even scores<\/strong><br \/>\n<strong>print the highest odd score<\/strong><br \/>\n<strong>print the count of scores in the 80s<\/strong><\/p>\n<p><a href=\"http:\/\/myfiles.evergreen.edu\/academics\/programs\/compcog-s17\/Handouts\/WriteCodeExample1Run.html\">See It Run<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Write Code #1 Problem:\u00a0\u00a0 Write a program to get test scores from the user until a 0 test score is entered. For each test, tell if it is below 50. \u00a0After you finish getting all the scores, print out the average of all the even scores, the highest odd score, and the number of scores [&hellip;]<\/p>\n","protected":false},"author":274,"featured_media":0,"parent":558,"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\/808"}],"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=808"}],"version-history":[{"count":0,"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/pages\/808\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/pages\/558"}],"wp:attachment":[{"href":"https:\/\/sites.evergreen.edu\/compcog17\/wp-json\/wp\/v2\/media?parent=808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}