Question: A college professor has a very simple method to track grades. The method is as follows: When an assessment is given, the answer sheets are
A college professor has a very simple method to track grades. The method is as follows: When an assessment is given, the answer sheets are collected in no particular order. As time allows, the professor grades the answer sheets, in the order they were collected, and enters the grades in a CSV file keyed by the Student ID. Three exams (2 mid-terms and a final) are given per semester. At the end of the semester, the professor prints out the three files, manually searches for the grades for each student (one grade per printout), and calculates the final grade to be the average of all three grades rounded to the nearest integer (rounding up if the fractional part is exactly 0.5).As the final grades are calculated, the professor enters the results in yet another CSV file to share with the Office of the Registrar. Besides causing eye strain, this method is time consuming, and error prone. In addition, the registrar's office prefers to have the final grades sorted by Student ID, which the professor is not doing. Your assignment, if you are willing to accept it, is to write the "Amazing Final Grade Calculator". The program should: Accept the names of four CSV files through command-line arguments. The first three files contain "Student ID, Grade" records, and the fourth is the name of the CSV output file to receive the final grades. Read the input files one by one. Every time a "Student ID, Grade" pair is read, create a node, and insert it into a singly linked list via the SLL_insert() function. The SLL_insert() function inserts the nodes into the list in ascending order based on the Student ID. The function implementation serves as proof of your newly found C Pointers wizardry. By the time the program finishes reading the input files, the length of the list should be triple the number of students because each student will have three consecutive nodes. The program must be able to support an outrageous number of students (hundreds of thousands). The final grades can now be easily calculated by averaging three consecutive nodes at a time. Specifically, by popping three nodes from the linked list, calculating their average, and writing the output in "Student ID, Final Grade" CSV format to the output file. If you do everything correctly as described above, the output file will be sorted by Student ID. The registrar's office staff are ecstatic, and they can't wait to put their hands on the sorted final grades. Don't disappoint them!
(Code is in C)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
