Reference no: EM132194772
Question: Write a C program that defines a data type (structure ) called course which includes the following fields on Computer Science courses:
Course name (string) e.g. comp230
(All course names start with the word "comp" followed by a three digit number for the course's number). The first of those numbers indicates the year level of the course (e.g. comp230 is for second year level students, while comp132 is for first year level students, and comp438 is for fourth year level students).
Number of students in course (integer)
Course's average grade (double)
Your program should read the information for up to a maximum of 20 courses from a file called course_info.txt and store it in an array of structures called courses.
Your program should then print the average grade for all first year courses, second year courses, third year courses, and fourth year courses as well as the highest of those averages.
Example:
Assume the file course_info.txt contains the following data:
comp132 50 71.30
comp230 73 68.72
comp142 72 75.6
comp232 90 62.73
comp432 30 70.23
Then your program should print the following result:
First year courses avg = 73.84
Second year courses avg = 65.41
Third year courses avg = No courses
Fourth year courses avg = 70.23
The highest average = 73.84
Note: Notice that the average calculations take into consideration the number of students in each course for example:
To calculate first year student average the program does the following:
(71.3 * 50 + 75.6 * 72) / ( 50 + 72) = 73.84
You need to turn in the following items:
A hard copy of your C program with your name, id, and section # typed on it as well as a hard copy of the content of file course_info.txt.
A hard copy of one complete successful run of your program (similar to that shown above)