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.
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)
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]);
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.
My professor has been going crazy assigning projects lately, 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 anyone willing to help, thanks!
student Quiz 1 Quiz 2 Quiz 3 Quiz 4 Quiz 5 1234 52 100 78 2134 90 77 3124 100 20 4532 32 5678 34 6134 34 55 78 45 7874 60 100 56 78 8026 10 78 9893 77 78 20 1947 45 78 55 55 78 80 3189 22 100 78 4602 78 5405 78 10 6999 89 78 High Score 100 100 100 90 80 Low Score 32 10 Average 46.2 42.3 70.5 75.7 49.7 z4 0 0 7 4 5860507000007 13377347525876-28- Z870288888888888027 *1 7 7 937777777777793 N0 0 0 1 5 5 6 6 7 8 9 0 1 90 5 119284556789190810 6572000 0000180 173411811945751917 NN(0 0 1 0 4 0 0 4 5 5 2 91 0 2 ,1 5 9 1 1 2 3 6 7 3 4 528101s ee rre 00g 444274463479259 tcca n3323737, 2 9 4 7 8 0 0 9 S S r e21-561808981649 d-23456789-23456hWV goA 1LStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started