Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C program that uses string processing functions to properly format a Comma Separated Values (csv) file of course information and store them into
Write a C program that uses string processing functions to properly format a Comma Separated Values (csv) file of course information and store them into an array of structures Once all data have been formatted and stored, your program should be able to: d. Term should be one character indicating semester (S, F,W") following by 4 digits indicating a year. For example S2010, W2014 a. Add new course b. Search for course information using either course name or course number on e. Each course can have up to three sections. For courses with less than three sections, term as the search key c. Display all or any course data. d. Save course information missing sections will be ZERO in courseSections amay. For example, 1,30,0for a course with two sections. Also, there are no courses with repeated section numbers (except 0). For example, sections 2,2,0 for a course are invalid 2- Your program should implement at least the following functions: a) loadCourseInfo: To read all data from the input file (courseInfo.csv) and Assume that the CourseInfo structure has been defined as follows format and store them in an array of structures. b) addCourseInfTo add a new course. Note that: struct CourseInfo a. CouseID should be unique and generated automatically by your program (last int courseID char courseName [401 char courseCode [10 char Term [6] int courseSections [3] courseID+1). b. Cour seCode is aso unique and you cannot have two courses with the same courseCode. So, before adding a course, search for the courseCode to be sure that you have not had it previously c. Number of sections cannot be more than 3. Also, section numbers for each course must be unique typedef struct CourseInfo courseInfo; loptional c) displayCourseInfo To print a table indicating the course Information. d) searchCourseID O: To search for a course information using courseID and print Example e) searchCourseName): To search for a course information using courseName and f) searchCourseTerm): To search all course information using Term (semester and 9) saveCourseInfo To save course information from the array of structures to a he course information if it exists. print the course information if it exists year) and print the list of all course information if it exists. CSV file (courseInfo.csv) Fields in the input file are comma separated as follows courseName Faculty,Subject,Level,Section1,Section2,Section3,Semester,Year Content of a sample input file programming,03,60,141,,30,0,W 2015 algebra,03,62,102,2,0,0,S,2013 religion,08,98,938,1,30,90,W,2015 Corresponding field values in the array of structures (after formatting): CourselD CourseName PROGRAMMING ALGEBRA CourseCode0360-141 Term Sections RELIGION 0898-938 W2015 0362-102 S2013 W2015 30 30 90 Hints 1-For formatting data, the following points are to be considered a. Course ID should be unique sequential integers starting from 1 (not from 0) b. The first letter of the course name must be a capital letter (upper case). c. Course Code should also be unique and store in the format as xxxx-xxx. The first xxxx part indicates faculty code (xx) and subject code (xx). The second xxx part indicates level. For example 0360-141
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started