Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that defines a data type (structure ) called course which includes the following fields on Computer Science courses: Course name (string)

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 courses 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)

Courses 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)

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

Step: 3

blur-text-image

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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions