The program allows user input scores on four tests. The average is computed, and
ID: 3891345 • Letter: T
Question
The program allows user input scores on four tests. The average is computed, and a letter grade is determined. Letter grades are based on 90 for an A, 80 for a B, and so on.
Examine the pseudocode that follows the introductory comments, and then find and correct all bugs. Correct the code in the file and be sure to clearly highlight the corrections.
_____________________________________________________________________________________
start
string name
num score
num NUM_TESTS = 4
num NUM_RANGES = 5
num RANGES[NUM_RANGES] = 90, 80, 70, 60, 0
string QUIT = "ZZZZZ"
string GRADES[NUM_RANGES] = "A", "B", "C", "D", "F"
num total
num average
num sub
output "Enter student name or ", QUIT, " to quit "
input name
while name <> QUIT
sub = 0
total = 0
while sub < NUM_TESTS
output "Enter score "
input score
total = total + score
endwhile
sub = 0
while average < RANGES
sub = sub + 1
endwhile
letterGrade = GRADES[sub]
output name, letterGrade
output "Enter student name or ", QUIT, " to quit "
input lettergrade
endwhile
stop
Explanation / Answer
start
Declare a test score array with four integers or float
Use for loop to get the user input value with the limit of 4 inside the above declared array.
For(int i=0;i<4;i++)
{
//statements
}
Loop the array using the other for loop one by one.
Using if condition to check the score with the limits range like
If(testScore[i]>=90,80,70,60 etc...
Print all the condition result to the console depends upon the condition range.
Stop
If the above solution is helpful to you in any way please rate it Or if you have any concerns please comment it, I will help you through
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.