You are on page 1of 12

Programming Languages(EL-255)

Complex Engineering Problem

Individually Submitted by:

Syed Muhammad Umar (EL-22121)

Group Members:

Shaheer Hashmi (EL-22090)


Arham Zafar (EL-22093)
Syed Ahmed Zulfiqar (EL-22110)
Syed Muhammad Umar (EL-22121)
Objective: Implementing Student Grade
Management System

Code for the project:


Code Test Run + Output + User Interaction

After running the code you are firstly asked to input the
number of students that you want to input the exam scores
for:

After you select the number of students:

You are then asked to input assignment scores, midterm


score and final exam score of a single student. There is a
limit set on the score range that you can enter, if you enter a
score out of that range, the program will terminate itself. You
cannot enter a negative value for any of the exam scores nor
can you enter a value above 100. Also the compiler
accommodates the data for a total of 50 students only.
After you finish inputting all scores for all the respective
students, The compiler then displays the results:

● Average Assignment score which was calculated by the


array values, the array was named as assignments that
were inputted for each student.
● Average Midterm score, which was inputted through the
variable named midterm.
● Average Final exam score which was inputted through the
variable final_exam.
● Highest and lowest scores for all respective student data.
● Final calculated grades in descending order.
Flowchart for the Code written:
Modules and Functions:

Following functions were used in the code above, their usability


and purpose are mentioned:

​ 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:

​ Fixed Array Size:


● The code uses a fixed array size (MAX_STUDENTS = 50) to
store student information. This limits the program to handling
up to 50 students. If you need to handle more students, you
would need to modify the code and use dynamic memory
allocation (e.g., malloc and free).
​ Input Validation:
● While the code performs basic input validation (checking for
negative scores and scores exceeding the maximum allowed),
it doesn't handle all possible invalid inputs. For instance,
it doesn't check if the student name contains only valid
characters or if the ID is unique for each student.
​ Assumption of Equal Assignment Weights:
● The calculation of the final grade assumes equal weights for
each assignment. If the assignments have different weights,
the code would need modification to accommodate these
variations.
​ Limited Error Handling in main Function:
● The main function assumes that the input for the number of
students is valid and within the specified range. It doesn't
handle cases where a non-numeric input is provided,
leading to unexpected behaviour.
​ Limited Sorting Algorithm:
● The sorting algorithm used to sort students based on final
grades is a simple bubble sort. While it works for a small
number of students, it may not be the most efficient for larger
datasets. Consider using more efficient sorting algorithms for
scalability.
​ Limited User Interaction:
● The code relies on the console for input and output, making
the user interaction basic. For a more user-friendly interface,
you might consider developing a graphical user interface
(GUI) or a web-based interface.
​ No File I/O:
● The code does not include functionality for reading student
information from a file or saving the results to a file. This
could be a limitation if you want to store and retrieve data
persistently.
​ Assumed Validity of Weightings:
● The code assumes predefined weightings for assignments,
midterm, and final exam scores. If these weightings need to
be flexible or customizable, the code would require
modification.

You might also like