programming assignment

In C language please In this programming assignment, you will implement a singly linked list for student information. You can use code provided in the lecture to help finish this assignment. Create a header file named linkedlist.h. In this file you will do the following: Include the header guards Declare the struct named LLNode for a node in the linked list. Each node in the linked list should have with four data members: id(integer), name(10 chars), gpa(double), and a pointer to the next node. You will write five functions (see below linkedlist.c). Declare their prototypes. Function names should be exactly as shown below. Each student information is stored in a separate line in the file. All 3 parameters of the student information will be separated by commas. See the example “a10-input.csv“` file shown below (also provided as attachment). 1002,John,3.5 1003,Steve,2.5 1001,Mary,3.0 1004,Sarah,2.8 Create a source file named linkedlist.c. In this file, you will do the following: Write a function named createNode(). This function will dynamically allocate a new node for the linked list. It takes in three parameters – integer value for id, char array for name, and double value for gpa. This function will return a pointer to the new node created. Write a function named insertNode(). This function will insert a node into the linked list in alphabetical order of the name. The function takes in a pointer to the head of a linked list and a pointer to a new node that will be inserted. It will return a pointer to the new head of the linked list. Write a function named averageGPA(). This function takes in one parameter – pointer to the head of the linked list. It will traverse the linked list, calculate the average GPA for all the students present in the linked list, and return the average value. Write a function named printLL(). This function takes in one parameter – pointer to the head of the linked list. The function return type will be void. It will traverse the linked list and print out each node’s data members in the format (id,name,gpa). Write a function named destroyLL(). This function takes in one parameter – pointer to the head of the linked list. It will recursively deallocate all the nodes in the linked list. The return type is a pointer to the LLNode though the function will return NULL at the end. Create a main.c source file with the main() that will do the following: Read in the name of the input file a10-input.csv through the command line argument. If the argument is not there, print out the error message: ERROR NO ARGS and end the program. Open the file for reading. If the file does not open, print out the error message: ERROR FILE NOT OPEN and end the program. Go through the file line by line until the end of the file. As we are using a linked list we do not need to know the number of lines beforehand. Call createNode() using the read values for each line, i.e. each student entry. Call insertNode() to insert this new node in the linked list. Remember that the insertion will happen in the sorted alphabetical order of the name. Once the entire file is read and the linked list is create, close the file. Call averageGPA() to calculate the average GPA of the all the students. Print out the returned average value with exactly two decimal places. Call printLL() to print out the linked list in the format mentioned below. Call destroyLL() to destroy the entire linked list. Example Output for the sample input file attached – a10-input.csv Average = 2.95 (1002,John,3.50) -> (1001,Mary,3.00) -> (1004,Sarah,2.80) -> (1003,Steve,2.50) ->