Question: in C++ Instructions Consider a file containing a double dimensional array, where each row represents a students grades, and each column represents all the grades

in C++

Instructions

Consider a file containing a double dimensional array, where each row represents a students grades, and each column represents all the grades received on a specific exaam (example below). For the sake of simplicity, assume there are 10 students (rows) and 5 exaams (columns). We will not be testing your program with any other numbers. Read in these grades, find each students average grade, the average grade scored for each exaam, then write the grades and averages to a file in the format described below. Create your own input file for testing purposes, with numbers separated by spaces. You are provided with the definitions for several functions that will help you on the next page - YOU ARE REQUIRED TO USE THESE FUNCTIONS.

Example of Input File

100 70 75 80 100

98 45 99 100 95

65 78 75 81 75

100 78 99 34 100

58 64 72 89 88

87 82 84 48 76

100 100 98 100 98

38 45 89 76 76

56 80 91 92 90

87 70 72 80 72

Required Functions

1. void readGrades(string fileName, int numberOfExaams, int numOfStudents);

a. This function should read in the grades from your file, and store it in a double-dimensional array, which should be a global variable.

2. void getWeights(double weights[], int numOfExaams);

a. Inside this function, you should accept user input from the keyboard (use cin) in order to fill the weights[] array with the relative weight of each exaam (you may use any values you like, but they should all add up to 1).

b. Note: You are passing in weights[] by reference, and therefore any operations performed on the array will modify whichever array is initially passed into it.

3. void getAvgsOfExaams(double exaamAvgs[], int numOfExaams, int numOfStudents);

a. This function should fill the array exaamAvgs with the average grade scored by all students on each exaam.

b. Note: Again, you are passing in exaamAvgs[] by reference, so any modifications inside the function will modify the array that is initially passed into the function

4. void getAvgsOfStudents(double studentAvgs[], double weights[], int numOfExaams, int numOfStudents);

a. This function should fill studentAvgs[] with the weighted averages of their two exaams.

5. void writeFinalGrades(double exaamAvgs[], double studentGrades[], int numOfExaams, int numOfStudents);

a. Writing to a file titled finalgrades.txt, the students grades should be outputted, with each row followed by its final average, and each exaams overall average at the bottom of their corresponding columns.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!