Write a program that asks five users to enter each five test scores. We assume t
ID: 3759738 • Letter: W
Question
Write a program that asks five users to enter each five test scores. We assume that user will only enter the scores between 0 and 100 inclusively. Therefore, there is no need for input validation. The program should determine the average of the five test scores for each user and display a letter grade for each average.
Write a fully working Raptor program that designs the following procedures some of which simulate functions:
-Use a procedure called computeAverage that accepts five test scores as arguments and another argument, the sixth one, to return the average of the scores for each user. Keep in mind that a procedure does not have a return statement but we are simulating the return statement in a procedure using a parameter in the procedure.
-Use a procedure called determineLetterGrade that accepts the computed average and returns the letter grade corresponding via another parameter.
-Finally, use a procedure called displayResult that accepts the average and letter grade for each user and displays the user ID (User 1, User 2, User 3, User 4, or User 5), average, and letter grade.
Use the following grading scale:
Score Letter Grade
90–100 A
80–89 B
70–79 C
60–69 D
Below 60 F
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
int Score[5];
for (int i = 0; i < 5; ++i)
{
printf("Enter Score %d: ", i);
cin >> Score[i];
}
for (int i = 0; i < 5; ++i)
{
if (Score[i] >= 90)
printf("Grade %d: A ", i);
if (Score[i] >= 80 && Score[i] < 90)
printf("Grade %d: B ", i);
if (Score[i] >= 76 && Score[i] < 80)
printf("Grade %d: C ", i);
if (Score[i] >= 70 && Score[i] <= 75)
printf("Grade %d: D ", i);
if (Score[i] < 70)
printf("Grade %d: F ", i);
}
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.