Write Code Example 2: English

Problem:  

Write a program to get test scores from the user until a 0 test score is entered. For each score, tell if it is an odd or an even score. If the score is over 90, tell the user “good job” for that test. When you finish entering all the scores, Print the average of all the odd scores, the highest even score, and how many scores were below 60.

SOLUTION IN ENGLISH (ONE EXAMPLE)

get a test score

while the score is not a 0
     if the score is odd
          print the score is odd
     if the score is even
          print the score is even
     if the score is over 90
          tell the user good job
     if the score is odd
          add 1 to the odd scores total
          add this score to the total for odd scores
     if this score is even
          if this is the highest even score so far
                rename the highest even score as this score
     if this score is less than 60
          add 1 to the scores less than 60
     get the next score

print the sum of the odd scores divided by the number of odd scores
print the highest even scores
print the number of scores less than 60

Leave a Reply

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