Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

this homework is driving me nuts heres what it calls for For research purposes a

ID: 3609511 • Letter: T

Question

this homework is driving me nuts heres what it calls for For research purposes and to better help students, theadmissions office of your local university wants to know howwell female and male students perform in certain courses. youreceive a file that contains female and male students GPAs forcertain courses. Due to confidentiality, the letter f is used forfemale and m for male. every file entry consists of a letter codefollowed by a GPA. each line has one entry. The number of entriesin the file is unknown. write a program that computes and outputsthe average GPA for both male and female students. format yourresults to 2 decimal places. your program should use the followingfunctions. a. function openfiles: this function opens the input andoutput files, and sets the output of the floating-point numbers totwo decimal places in a fixed decimal format with a decimal pointand trailing zeros. b. Function initialize: This function initilizes variablesjsuch as countFemale, countMale, sumFemaleGPA, andsumMaleGPA. c. Function sumGrades: This function finds the sum of thefemale and male students GPAs d. function averageGrade: this function finds the average GPAfor female and male students e. Function printResults: This function outputs the relevantresults f. there can be no global variables. use the appropriateparameters to pass information in and out of the functions this homework is driving me nuts heres what it calls for For research purposes and to better help students, theadmissions office of your local university wants to know howwell female and male students perform in certain courses. youreceive a file that contains female and male students GPAs forcertain courses. Due to confidentiality, the letter f is used forfemale and m for male. every file entry consists of a letter codefollowed by a GPA. each line has one entry. The number of entriesin the file is unknown. write a program that computes and outputsthe average GPA for both male and female students. format yourresults to 2 decimal places. your program should use the followingfunctions. a. function openfiles: this function opens the input andoutput files, and sets the output of the floating-point numbers totwo decimal places in a fixed decimal format with a decimal pointand trailing zeros. b. Function initialize: This function initilizes variablesjsuch as countFemale, countMale, sumFemaleGPA, andsumMaleGPA. c. Function sumGrades: This function finds the sum of thefemale and male students GPAs d. function averageGrade: this function finds the average GPAfor female and male students e. Function printResults: This function outputs the relevantresults f. there can be no global variables. use the appropriateparameters to pass information in and out of the functions

Explanation / Answer

please rate - thanks Hope this will do! #include #include #include using namespace std; void initialize(int &,double &); int openfiles(ifstream &,ofstream &); void sumGrades(double,double&,int&); double averageGrade(double,int); void printResults(string,double,ofstream &); int main() {int i,countFemale,countMale; double sumFemalesGPA,sumMalesGPA,avgMales,avgFemales,gpa; char s; ifstream in; ofstream out; i=openfiles(in,out); if(i==1)     return 0; initialize(countFemale,sumFemalesGPA); initialize(countMale,sumMalesGPA); in>>s; while(in)     {in>>gpa;         if(toupper(s)=='F')             sumGrades(gpa,sumFemalesGPA,countFemale);         else             sumGrades(gpa,sumMalesGPA,countMale);     in>>s;     } avgMales=averageGrade(sumMalesGPA,countMale); avgFemales=averageGrade(sumFemalesGPA,countFemale); printResults("Male",avgMales,out); printResults("Female",avgFemales,out);            in.close();     out.close();     system("pause");     return 0; } double averageGrade(double sum,int count) {return sum/count; } void sumGrades(double gpa, double &sumgpa,int &count) {count++; sumgpa+=gpa; return; } void printResults(string s,double g,ofstream &out) {out