Professor Rick wants to have a faster turn-around time for manually calculating the grades of your exams. Knowing that you are an exceptional programmer, he has asked you to write a computer program that calculates the maximum, minimum, and average grade for any upcoming tests your class will be taking.
The program reads a list of grades from a file. The file will have one number grade per line. The first number in the file will be how many points the test was worth. All subsequent lines will represent a student’s grade. The program should read each student grade into an array. The program should then use the data stored in that array to figure out which grade is the highest, which grade is the lowest, and what the class average is both as a point grade and as a percentage (number of points earned divided by the maximum number of points that can be earned). The program writes all of this calculated information to a file.
The program should consist of 6 functions:
int main(): Your main function should read the file and store the contents of the file into an array. main() should then call the other functions of the program (described below) and print their outputs to a file.
int max(int[]): This function should take the array of test scores as input and output the highest grade in the class
int min(int[]): This function should take the array of test scores as input and output the lowest grade in the class
int sum(int[]): This function should take the array of test scores as input and output the sum of all of the scores.
double average(int[]): This function should take the array of test scores as input and output the average score. It should do this by returning the result of calling your previously written sum() function and dividing by the number of student grades stored in the array.
double average_percentage(int[], int): This function should take the array of test scores and the maximum possible points as input. It should return the percentage by calling your previously written average() function and dividing the output of this function by the maximum possible points parameter.
Your output file should contain a line for each of the following:
the highest grade
the lowest grade
the average grade
the average percentage