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

This assignment is a grade calculator(using c not c++). A portion of the code is

ID: 3791251 • Letter: T

Question

This assignment is a grade calculator(using c not c++).

A portion of the code is included in the nested loop document. It will need to be modified of course to include the grade variable and weight array variable. Also, change the marks array indices to 4 students and 5 marks so as to make it easier to input the info.

The weight array should be described as follows: weight[] = {1, 1, 0.8333, 0.75, 0.6667}

The output should look like:

Student #1's final mark is 74.62%

Student #2's final mark is 68.46%

Student #3's ...

START IS no j 4 yes IS no i 5 yes input marks [ji[ij i 1 j -j 1 IS no 4 END yes grade 0 no /output IS I 5 j, grade yes weight ilxmarkslil i 1 j -j 1

Explanation / Answer


// C code
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>

int main()
{
int totalStudents = 4, i, j = 0;
double weight[] = {1, 1, 0.8333, 0.75, 0.6667};

double marks[4][5];

  
while(j < 4)
{
i = 0;
while(i < 5)
{
printf("Enter marks for student #%d: ", (j+1));
scanf("%lf",&marks[i][j]);
i++;
}
j++;
}
  

j = 0;
while( j < 4)
{
double grade = 0;
i = 0;
while( i < 5)
{
grade = grade + weight[i]*marks[i][j];
i++;
}

printf("Student #%d final mark is %0.2lf ",(j+1),grade);
j++;
}
return 0;
}

/*
output;

Enter marks for student #1: 9
Enter marks for student #1: 8
Enter marks for student #1: 7
Enter marks for student #1: 8
Enter marks for student #1: 7
Enter marks for student #2: 8
Enter marks for student #2: 9
Enter marks for student #2: 7
Enter marks for student #2: 7
Enter marks for student #2: 9
Enter marks for student #3: 9
Enter marks for student #3: 9
Enter marks for student #3: 8
Enter marks for student #3: 9
Enter marks for student #3: 8
Enter marks for student #4: 7
Enter marks for student #4: 8
Enter marks for student #4: 6
Enter marks for student #4: 8
Enter marks for student #4: 9

Student #1 final mark is 33.50
Student #2 final mark is 34.08
Student #3 final mark is 36.75
Student #4 final mark is 32.00


*/

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