Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements: Your C program will read data from a text file (), store them in a linked list, perform some operations on the data, and

image text in transcribed
image text in transcribed
image text in transcribed
Requirements: Your C program will read data from a text file (), store them in a linked list, perform some operations on the data, and write the processed data to another text file. An input text file contains data of students. The data for each student in the file consists of: student id (9 digit integer number), student name and surname (in a single field), birth date in "DD/MM/YYYY" format, gender ('F' for female, 'M' for male), department code (at most 5 characters) and class (int from 1 to 4). The fields are separated by a semicolon", Your cs363_hw2_surname_name.c C program will do the followings: Declare the necessary structures. (The birth date will be stored as a single integer number in the YYYYMMDD format.) Input from user the name of the input text file. Read all the data which is in this text file and store in a linked list. ATTENTION: The linked list will be sorted at all times by birth date of students. Display all students in the linked list Input a department code, and display students in that department Increment by 1 the class field of all students. Remove the nodes that has class value > 4 from this list, but add them to a second list. So do not free them, just add to a 2nd linked list. Display the first linked list again and display the second linked list Write your program as modular as it can be. The main program should mainly consist of necessary declarations and function calls. Sample lines from a sample input file: 149875280; Burcu Aksu;04/04/1994;F;CS;3 160051581; Erhan Orkun;06/05/1995;M; EEE;3 155898933; Nuh Kaplan;26/01/1998;M;ME;2 157577471; Turgut Aksu;08/03/1995;M;IE; 4 185060240; Hulya Kurt;04/08/1999;F;Cive:1 Sample run: Enter file name: hw2.txt Students No. Id Name SEBE 1. 158763487 Aysel Limoncu 2. 155313279 Tulin Can 3. 148362136 Kaan Aksoy 4. 149875280 Burcu Aksu G Birthdate Dept Class ====== 05/01/1994 CS 3 12/02/1994 ME 3 M 05/03/1994 IE 3 04/04/1994 EEE 3 24. 174752325 Canan Ekermen 30/06/2000 Cive Enter department code: cs Students in cs: No. Id Name ==== ============ 1. 158763487 Aysel Limoncu 2. 149875280 Burcu Aksu G Birthdate Dept Class ===== F 05/01/1994 CS 3 F 04/04/1994 CS 3 6. 189666820 Mert Aksoy M 13/12/1998 CS Student's class is incremented. 6 students are removed because they have graduated. G Birthdate Dept Class SEE Students: No. Id Name ESSE 1. 158763487 Aysel Limoncu 2. 155313279 Tulin Can 3. 148362136 Kaan Aksoy 05/01/1994 Cs 12/02/1994 ME M 05/03/1994 IE 18. 174752325 Canan Ekermen 30/06/2000 Cive 2 Graduated Students: No. Id Name 1. 146645310 Sevda Egemen 2. 157577471 Turgut Aksu G Birthdate Dept Class SEE SEEEE F 04/08/1994 CS 5 M 08/03/1995 IE 5 6. 151015628 Fatma Can F 15/07/1997 ME 5 Hint-1: To read from a string in "DD/MM/YYYY" format (e.g. "24/07/1998") into three integer variables, you can use a statement similar to 39canf (datestring, "d/%d/d", sday, smonth, syear); Hint-2: You can use the following functions if you like: 1 getnode: allocate memory for a node and return its address. nodeptr getnode() return(nodeptr) malloc (sizeof(node_D) ) ); 1 // end getnede // dateStrInt: Converts "DD/MM/YYYY" to int YYYYMMDD date format, and // returns it. Sample function call: ymd = dateStrInt("04/12/2018"); int dateStrInt(char str[]) { int d, m, Y; sscanf (str, "%d/%d/%d", &d, &m, &y); return (y * 10000 + m * 100 + d); } // end dateStrint // splitDate: separates day, month and year from YYYYMMDD int date. // Sample function call: splitbate (20181204, &day, Emon, &year); void splitbate (int ynd, int *dp, int *mp, int *yp) { *dp = ymd 100; *mp = (ymd / 100) 100; *YP ymd / 10000; | } // end splitDate

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions