Answer to Question #255133 in Algorithms for Israel

Question #255133

Algorithm for a program to allow multiple sets of scores to be averaged. Valid entries must be numeric and in the range of 0 to 100. Calculate the average of the scores entered. Allow any number of scores to be entered per data set but assume that there will be at least one score entered. Use a sentinel-controlled loop variable to terminate the loop. After values are entered and average is calculated, test the average to determine whether an A, B, C, D or F should be recorded. The scoring rubric is as follows: A: 90 to 100; B80 to 89; C 70 to 79; D 60 to 69 and F <60.


1
Expert's answer
2021-10-25T05:31:22-0400
Start 
  Declare variable double average
  Declare variable double sum = 0
  Declare variable double score = 1
  Declare variable totalScores = 0
  while score >= 0 and score <= 100
      Read score
      if score >= 0 and score <= 100 then
          sum =sum+ score
          totalScores=totalScores+1
       end if
  end while
  average = sum / totalScores
  Display average
  if average >= 90 and average <= 100 then
        Display "Grade: A"
  else if average >= 80 and average <= 89 then
        Display "Grade: B"
  else if average >= 70 and average <= 79 then
        Display "Grade: C"
  else if average >= 60 and average <= 69 then
        Display "Grade: D"    
  else
        Display "Grade: F")
  End if
Stop

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS