Question
Assignment Compute Test Score Grades using array of Structures You are asked to write a program that will compute the grades for each students test
Assignment Compute Test Score Grades using array of Structures
You are asked to write a program that will compute the grades for each students test score, number of students passed the score and the test score average. Test scores and grades will be stored in an array of structures-students. The score average is rounded to one digit after decimal point.
There are 5 students and NUM_STUDENTS is defined as a constant.
The element of the array-students has the following members:
struct studentInfo {
string id;
int score;
char grade;
};
studentInfo students[NUM_STUDENTS]; //array of structures declaration
The grades are assigned based on the following table.
Score Grade
90 - 100 A
80 - 89 B
70 - 79 C
60 - 69 D
0 - 59 F
Use the following functions to perform different tasks.
//Function getScore is used to enter student id, test score
getData (students, NUM_STUDENTS);
//Function computeGrade will determine the grade for each student and store the grade
computeGrade (students, NUM_STUDENTS);
//Function pass will determine and return the number of passing scores.
//A score greater than or equal to 60 is considered a passing score.
numberPasses = pass (students, NUM_STUDENTS);
//Function findAverage will compute average of test scores and return the test score //average
averageScore = find_Average (students, NUM_STUDENTS);
//Function printSummary will print the output as shown.
printSummary (students, numberPasses, averageScore, NUM_STUDENTS);
The output will be displayed as follows:
ID Score Grade
123 90 A
345 60 D
333 70 C
678 59 F
555 87 B
Number of students passed the test: 4
The test score average: 73.2 (rounded to one digit after decimal point)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started