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

Write a C Program that will perform the following tasks: Task 1 : Allow the user

ID: 640244 • Letter: W

Question

Write a C Program that will perform the following tasks:

Task 1: Allow the user to enter in the data for each student

Task 2: For each student, calculate their total homework points, their total exam points, and their class percentage. The formulas to use are as follows:

total homework points = HWK 1 + HWK 2 + HWK3

total exam points = EXAM 1 + EXAM 2

class percentage = (total homework points/1.875) + (total exam points/3.333)

(the class percentage will range from 0 to 100.)

Task 3: Print out the name for each student followed by the results of your three calculations from Task 2.

Task 4: Calculate and print the average exam 1 score and the average exam 2 score for the five students.

Explanation / Answer

#include "stdio.h"

int main(){
   float arr[5][3] = {0.0};
   char names[][256] = {"Ronaldo", "Messi", "Neymar", "Bale", "James"};
   float E1 = 0, E2 = 0;
   int i = 0, j = 0, k = 0, temp = 0;
   for(i = 0; i < 5; ++i){
       printf("Student %s ", names[i]);
       for(j = 0; j < 3; ++j){
           if(j == 0){
               for(k = 0; k < 3; ++k){
                   printf("Home Work%d: ", k + 1);
                   scanf("%d", &temp);
                   arr[i][j] += temp;
               }
           }
           else if(j == 1){
               for(k = 0; k < 2; ++k){
                   printf("Exam%d: ", k + 1);
                   scanf("%d", &temp);
                   arr[i][j] += temp;
                   if(k == 0){
                       E1 += temp;
                   }
                   else{
                       E2 += temp;
                   }
               }
           }
           else{
               arr[i][j] = (arr[i][0] / 1.875) + (arr[i][1] / 3.333);
           }
       }
       printf(" ");
   }
   for(i = 0; i < 5; ++i){
       printf("%s: ", names[i]);
       printf("Total Homework Points = %.3f ", arr[i][0]);
       printf("Total Exam Points = %.3f ", arr[i][1]);
       printf("Class percentage = %.3f ", arr[i][2]);
   }
   printf("Average Exam One scores is %.3f ", E1 / 5);
   printf("Average Exam Two scores is %.3f ", E2 / 5);
   return 0;
}

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