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

4. Write a program which will use the following functions: a) void Function GetS

ID: 3598321 • Letter: 4

Question






4. Write a program which will use the following functions: a) void Function GetScore that will read four different user inputs: testl, test2, midterm and final and use them as reference parameters. b) A value return function Average that would take the four inputs: testl, test2, midterm and final and computes the average using the formula below: average = 02t(test1 + test2) + 0.25* midterm + 0.35* final c) A value return function Grade that returns the letter grade, and takes the testaverage as input, and computes the grade based on the following table: testaverage:

Explanation / Answer

#include<stdio.h>
void getScore(int *a,int *b,int *c,int *d)
{
    int p,x,y,z;
    printf("enter test1,test2,midterm,final marks ");
    scanf("%d%d%d%d",&x,&y,&z,&p);
    *a=x;
    *b=y;
    *c=z;
    *d=p;
  
  
}
float average(int a,int b,int c,int d)
{
  
    return ((0.2*(a+b))+(0.25*c)+(0.35*d));
}
char Grade(float a)
{
  
    if(a>=90)
    {
                return 'A';

    }else if(a>=80)
    {
                return 'B';

    }else if(a>=70)
    {
                return 'C';

    }else if(a>=60)
    {
                return 'D';

    }else
    {
        return 'F';
    }
  
}
void Print(float a,char g)
{
  
    printf("Average:%f ",a);
    printf("Grade:%c ",g);
}
int main() {
int test1,test2,midterm,final;
   float a;char g;
    getScore(&test1,&test2,&midterm,&final);
       a=average(test1,test2,midterm,final);
     
       g=Grade(a);
       Print(a,g);

}

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