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

Write a C++ program that can be used to determine grades at the end of the semes

ID: 3765926 • Letter: W

Question

Write a C++ program that can be used to determine grades at the end of the semester. For each student, who is identified by an integer number between 1 and 60, four examination grades must be kept. Additionally, two final grade averages must be computed. The first grade average is simply the average of all four grades. The second grade average is computed by weighting the four grades as follows: the first grade gets a weight of 0.2, the second grade gets a weight of 0.3, the third grade a weight of 0.3, and the fourth grade a weight of 0.2; that is computed as:

0.2 * grade1 + 0.3 * grade2+ 0.3* grade3 + 0.2 * grade4

Using this information, you are to construct a 60 X 7 two dimensional array, in which the first column is used for the student number, the next four columns for the grades, and the last two columns for the computed final grades. The output of the program should be a display of the data in the completed array.

For the test purposes, the following table is provided:

Your program should print the grade matrix ( table gridline not required), including the averages. Then it should calculate the mean and standard deviation for both averages for the class and print the results.

Program organization: The main() function should declare and populate the array with the test data shown above. It should then call a function, passing in the array as a parameter. The function should perform the calculations and print the result.

Student Grade 1 Grade2 Grade 3 Grade 4 1 100 100 100 100 2 100 0 100 0 3 82 94 73 86 4 64 74 84 94 5 94 84 74 64

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
void printarray (int [ ][5]);
int main ( )
{

cout << "Student" << setw(12) << "Grade 1"<< setw(15) << "Grade 2"<< setw(15)<<"Grade 3"<< setw(15)<< "Grade 4"<< setw(15)<< "Average 1"<< setw(15)<<"Average 2"<<endl;

int array1 [5] [5] = { {1, 100, 100, 100, 100}, {2, 100, 0, 100, 0},{3, 82, 94, 73, 86},{4, 64, 74, 84, 94},{5, 94, 84, 74, 64}};
cout<<printarray (array1);

return 0;
}
void printarray (int a[ ] [5] )
{
for(int c=0; c<5; c++)
cout<<a;
}

A regular average is defined as the sum of the numbers divided by the number of numbers. So, in your first entry for the array, {1, 100, 100, 100, 100}, the average would be, (100 + 100 + 100 + 100) / 4, which would equate to 100.

For a weighted average, you take the sum of each score multiplied by its weight. So, again using your first example, the weights as given are 20%, 30%, 30%, and 20% for each score. WA = .2*100 + .3*100 + .3*100 + .2*100.

In the code it could be array1[1][5] = (array[1][1] + array[1][2] + array[1][3] + array[1][4]) / 4 for the regular average

And array1[1][6] = array[1][1] * .2 + array[1][2] * .3 + array[1][2] * .3 + array[1][4] * .2 for the weighted, both of these could be put into a for loop for (int i = 0; i < 60; i++) {replace first 1 above, with i here}


As for printing out the array, you are on the write track with your printarray funtion; you would not need to call it ascout << printarray, just printarray(array1) would work.
If you replace the cout << a with an extra for loop

I am not very good at explaining myself sometimes, so if you have any questions about the above, just let me know.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote