Answer:
countLetterGrades:
void countLetterGrades(double grades[], const int SIZE, int &numberOfAs,int &numberOfBs,int &numberOfCs,int &numberOfDs,int &numberOfFs) {
for(int i = 0; i < SIZE; i++){
if(grades[i]>85){numberOfAs++;}
else if(grades[i]>75){numberOfBs++;}
else if(grades[i]>65){numberOfCs++;}
else if(grades[i]>55){numberOfDs++;}
else{ numberOfFs++;}
}
}
printData:
void printData(double average, int numberOfAs,int numberOfBs,int numberOfCs,int numberOfDs,int numberOfFs)
{
cout<<"Average: "<<average<<endl;
cout<<"Number of A's: "<<numberOfAs<<endl;
cout<<"Number of B's: "<<numberOfBs<<endl;
cout<<"Number of C's: "<<numberOfCs<<endl;
cout<<"Number of D's: "<<numberOfDs<<endl;
cout<<"Number of F's: "<<numberOfFs<<endl;
}
Step-by-step explanation:
Your question is poorly formatted. (See attachment for proper presentation of question)
------------------------------------------------------------------------------------------------------------
The first step is to go to the main function and replace
//TODO: Add function calls
with the following 4 lines of code:
getGrades(grades,SIZE);
average = getAverage(grades,SIZE);
countLetterGrades(grades, SIZE, numberOfAs,numberOfBs,numberOfCs,numberOfDs,numberOfFs);
printData(average, numberOfAs,numberOfBs,numberOfCs,numberOfDs,numberOfFs);
------------------------------------------------------------------------------------------------------------
1. getGrades(grades,SIZE);
This calls the getGrade functions; The getGrade function is where the user inputs 5 grades for a student
2. average = getAverage(grades,SIZE);
Next, is to get the average of the input grades. This is done using the above and the average is stored in variable average
3. countLetterGrades(grades, SIZE, numberOfAs,numberOfBs,numberOfCs,numberOfDs,numberOfFs);
Next, is to get letter grade of each number grade. This is done using countLetterGrades function.
4. printData(average, numberOfAs,numberOfBs,numberOfCs,numberOfDs,numberOfFs);
The above 3 functions populate data for average, numberofAs to numberofFs; This values are passed to printData function to to display program output.
------------------------------------------------------------------------------------------------------------
Next complete countLetterGrades and printData functions as seen in the answer section.
For clarity, see the attached cpp file for line by line explanation of the complete code