Question
float get_section_average(char *filename, int section_num); This function will open a datafile whose name will be passed as an argument in filename, read the records, and
float get_section_average(char *filename, int section_num);
This function will open a datafile whose name will be passed as an argument in filename, read the records, and calculate the average score of all students enrolled in section_num. That is, for each student, you will check to ensure that the section number (last field) matches section_num. If it does, then you will add their score (third field) to a total sum and increment a counter tracking the number of students enrolled in the section. Once all records have been read, you will divide the sum by the number of sutdents enrolled and return the class average.
The Big Idea At the end of a semester there comes a time when letter grades have to be assigned to students in cS 240. To help out the process, we've created a database that contains various student information including grades Given this database, users can formulate queries using specific constraints to extract valuable informationfrom the raw data unprocessed information). In this homeworK, We Will manipulate some of the data contained in this "grade database." You will design a simple set of database query functions that will: - calculate the overall average score for a given section Determine the top score out of all sections Generate a list of students scoring lower than a provided cutoff threshold for all sections Generate a final grade report based on predetermined cutoff thresholds for a given section Examine "hwi.h" carefully. It contains declarations for the global variables, constants, and the prototypes for the functions you will write The Assignment The necessary information about opening/reading from/writing to files is both in the class text and the lecture slides. Functions YouWill Write You Will wrlte the Tollowing Tunctions: float get_section_average(char *filename, int section_num); This function will open a datafile whose name will be passed as an argument in filename, read the records, and calculate the "average score" of all students enrolled in section_num. That is, for each student, you will check to ensure that the section number (last field) matches section_num. If it does, then you will add their score (third field) to a total sum and increment a counter tracking the number of students enrolled in the section. Once all records have been read, you will divide the sum by the number of sutdents enrolled and return the class average. int get_top_score (char *filename); This function will open a datafile whose name will be passed as an argument in filename, read through all records, and return the maximum final score out of alIsectionsStep 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