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

This is within C Programing Write and test a grade book program that uses an arr

ID: 3772091 • Letter: T

Question

This is within C Programing

Write and test a grade book program that uses an array.

The program should allow the user to enter grades until the user indicates he or she is done entering data.

When data entry is complete, the program should display the grades entered.

The program should then calculate the average and print it out.

Write and test a grade book program that uses a linked list.

The program should allow the user to enter grades until the user indicates he or she is done entering data.

When data entry is complete, the program should display the grades entered.

The program should then calculate the average and print it out.

Explanation / Answer

1)

#include <stdio.h>

int main()
{
int count = 0;
char letter_grade = 'x';
int a = 0, b = 0, c = 0, d = 0, e = 0;
int student_ID = 1;
double test1 = 0.0, test2 = 0.0, final_test = 0.0, semester_average = 0.0, class_average = 0.0;

do
{
printf("Enter student ID, 0 to terminate: ");
scanf("%d", &student_ID);

if(student_ID != 0)
{
printf("Enter score #1: ");
scanf("%lf", &test1);
printf("Enter score #2: ");
scanf("%lf", &test2);
printf("Enter score #3: ");
scanf("%lf", &final_test);

printf("%d have the following scores: %lf, %lf and %lf ", student_ID, test1, test2, final_test);
semester_average = (0.20*test1) + (0.30*test2) + (0.50*final_test);
printf("The semester average score for %d is %lf ", student_ID, semester_average);
if(semester_average >= 80)
{ letter_grade = 'A'; a++; }
else if (semester_average >= 65)
{ letter_grade = 'B'; b++; }
else if (semester_average >= 50)
{ letter_grade = 'C'; c++; }
else if (semester_average >= 40)
{ letter_grade = 'D'; d++; }
else if(semester_average >= 0)
{ letter_grade = 'E'; e++; }

printf("The grade for %d is %c ", student_ID, letter_grade);
count++;
printf("Student #: %d ", count);
}
}while(student_ID != 0);

printf(" Total number of student: %d ", count);
printf(" The number of grade A student is: %d ", a);
printf("The number of grade B student is: %d ", b);
printf("The number of grade C student is: %d ", c);
printf("The number of grade D student is: %d ", d);
printf("The number of grade E student is: %d ", e);

class_average = ((4*a) + (3*b) + (2*c) + (1*d))/count;

printf(" The class average is: %lf ", class_average);
return 0;
}

thank you

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