Professional Documents
Culture Documents
PL CEP Umar
PL CEP Umar
Group Members:
After running the code you are firstly asked to input the
number of students that you want to input the exam scores
for:
Main Function:
● Purpose: The main entry point of the program,
orchestrating the overall execution flow.
● Functionality:
● Declares an array of students to store information
for each student (up to a maximum of 50).
● Inputs the number of students (numStudents).
● Iterates through each student, calling functions to
input student information, calculate final grades,
and display statistics for the entire class.
● Exits the program.
inputStudentInfo Function:
● Purpose: Responsible for gathering information for a
single student.
● Functionality:
● Takes a pointer to a Student structure as a
parameter.
● Utilises scanf to input the student's name, ID,
assignment scores, midterm score, and final exam
score.
● Implements error handling to ensure valid input
(e.g., non-numeric input, negative scores, or scores
exceeding the maximum allowed).
● Updates the provided Student structure with the
inputted information.
calculateFinalGrade Function:
● Purpose: Computes the final grade for a single student based
on specified weightings.
● Functionality:
● Takes a pointer to a Student structure as a parameter.
● Applies weights (20% for assignments, 30% for
midterm, and 50% for the final exam) to calculate the
final grade.
● Updates the final_grade field in the provided Student
structure.
displayStatistics Function:
● Purpose: Displays various statistics for the entire class.
● Functionality:
● Takes an array of Student structures and the number of
students as parameters.
● Calculates and displays the average assignment scores,
average midterm score, and average final exam score
for the entire class.
● Identifies and displays the student with the highest and
lowest final grades.
● Sorts the students based on final grades in descending
order and displays the sorted list.
Limitations in this code:
There are certain flaws in the code above which have an impact
on the overall application and usage while using it on a large
scale or real-world scenarios: