Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create the following: a) Two global integer constants, NUM_STUDENTS3, NUMGRADES4

ID: 3719273 • Letter: C

Question

Create the following: a) Two global integer constants, NUM_STUDENTS3, NUMGRADES4 b) One dimensional string array of size NUM_STUDENTS, named students c) Two dimensional integer array of size NUM STUDENTS by NUM_GRADES, named grades d) Initialize students with "Alice", "Brenda" and "Chris" e) Initialize grades with Array 1: 76, 80, 88, 90 (Alice' s grades) Array 2: 57, 98, 69, 93 (Brenda' s grades) Array 3: 98, 83, 76, 85 (Chris's grades) f) Create an output function that outputs: Student: Alice Grades: 76, 80, 88, 90 Student: Brenda Grades: 57, 98, 69, 93 Student: Chris Grades: 98, 83, 76, 85 g) Implement an average function that computes the average of all grades stored in the array h) Modify the output function so that it calls the average function and displays the GPA as shown in the example output. Example Output Student: Alice Grades: 76, 80, 88, GPA: 83.5 90

Explanation / Answer

#include <iostream>

using namespace std;

#define num_students 3

#define num_grades 4

float avg(int grade[][num_grades],int n){

float a=0;

for (int i=0;i<num_grades;i++)

a+=grade[n][i];

return a/num_grades;

}

void print(string name[], int grade[][num_grades],int n)

{

cout<<"Student : "<<name[n]<<endl;

cout<<"Grades: ";

for (int i=0;i<num_grades;i++)

cout<<grade[n][i]<<" ";

cout<<" GPA : "<<avg(grade,n);

}

int main() {

string name[num_students]={"Alice","Bendra","cheris"};

int grades[num_students][num_grades]{

{76,80,88,90},{57,98,69,93},{98,83,76,85}

};

print(name,grades,0);

return 0;

}

Output: