Question: ************************************************************************************************************************************In this project, you will learn to construct a C program using file input/output, arrays, and loops. define two constants like MAX_STUDENTS and MAX_QUIZZES, with
************************************************************************************************************************************In this project, you will learn to construct a C program using file input/output, arrays, and loops.
define two constants like MAX_STUDENTS and MAX_QUIZZES, with values 40 and 5
respectively
In the main function, use variable declarations similar to the following:
int ID[MAX_STUDENTS];
int Scores[MAX_STUDENTS][MAX_QUIZZES];
int Hi[MAX_QUIZZES];
int Lo[MAX_QUIZZES];
double Avg[MAX_QUIZZES];
int numStudents;
Note that the variables representing student ID, high score, low score, and average score are
all one-dimensional arrays. There are as many IDs as there are students, but there are as
many high, low, and average scores as there are quizzes.
The scores are stored in a two-dimensional array.
The main function then will consist of calls to the three functions getData, calculate,
and printResults.
The getData function should be designed
to transfer data from the file myfile.dat into the corresponding arrays for student IDs and
the scores. define two variables: student_count and quiz_count to be incremented properly
In addition to storing the data from the file into the respective arrays, getData should keep
track of the student count and store it in the variable whose address is passed as parameter.
20. We initialize student_count to zero, begin a while-loop that terminates on encountering
EOF, and, for each student, read one score at a time using a for-loop for the five different
quizzes. Note that it is necessary to use a fscanf to read data from the file.
The while-loop can be started using the form:
while (fscanf (spIn, "%d", &stID[student_count]) != EOF)
22. The body of this while-loop should include a for-loop like:
for (quiz_count = 0; quiz_count
Within the for-loop, the data is read using a statement of the form:
fscanf (spIn, "%d", &Scores[student_count][quiz_count]);
24. Make sure that the student_count is incremented properly, and numStudents is assigned
the proper final value of the student_count before getting out of the getData function
Next, we consider the calculate function. As the structure chart suggests, there are are
three sub functions to this.
Taking one set of quiz scores at a time, We will use a function calcHiScore that returns
an int value which is the highest of all the quiz scores for that quiz. Hence, this function
will take three parameters, the Scores array, a quiz number, and the number of students.
The returned value needs to be stored in the array of high scores, and this will happen inside
of the calculate function.
The functions for the low score and the average score can be constructed in a similar manner
The printResults function needs to be carefully developed using a system of two nested
for-loops to print the two- dimensional array of scores first; next, a single for-loop for each
of high sores, low scores, and average scores needs to print them out on a separate row.
sample output is shown:
My professor has assigned three projects in the last two weeks. he has yet to grade the first of the three and has assigned this one before the middle one is due. I cannot keep up, if anyone can provide some assistance that would be fantastic. I included all the major requirements for the project in the description so it should all be there for the taking!
Student Quiz 1 Quiz 2 Quiz 3 Quiz 4 Quiz 5 1234 52 100 34 2134 90 30 3124 100 45 20 4532 17 77 5678 20 45 34 6134 34 80 45 7874 60 100 8026 70 9893 20 1947 2877 55 3189 100 4602 89 5405 6999 High Score 100 100 100 Low Score z4007458650700000 13377347525876128- Z8 028888888888802 177937777777777793 Z090 001556678901 "1 1 9 2 8 4 5 5 6 7 8 9 190810 6572000 0000180 -734118-194575-917 Z200-040045529-0 ,1 5 9 1 1 2 3 6 7 3 4 5 2 8 1010 ee rr 00 t444284463 79259CC n332373729478009SS e2-156-80898-649 d-23456789-23456hW go iL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
