Create an algorithm to display the letter grade in a course. A course grade is t
ID: 3938231 • Letter: C
Question
Create an algorithm to display the letter grade in a course. A course grade is typically reported as a real number with values from 0 to 100. Your algorithm should ask the user to provide a grade in numerical form and display the letter grade corresponding to a numerical grade if the entered value is between 0 and 100 inclusive. If the value is outside this range, ask the user to enter the value again.
Typical range of grades:
A:90<= grade
B:80<= grade <90
C:70<= grade <80
D:60<= grade <70
F: grade<60
Explanation / Answer
Here is the algorithm for you:
Algorithm: LetterGrade()
Prompt: "Provide a grade in numerical form in the range 0 - 100: "
Read numberGrade;
while(numberGrade < 0 or numberGrade > 100):
Prompt: "Provide a grade in numerical form in the range 0 - 100: "
Read numberGrade;
if numberGrade >= 90:
return 'A';
else if numberGrade >= 80:
return 'B';
else if numberGrade >= 70:
return 'C';
else if numberGrade >= 60:
return 'D';
else
return 'F'
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.