Question: Grade Book Modification- C++ Modify the grade book application so that it drops each students lowest score when determing the test scre averages and letter
Grade Book Modification- C++ Modify the grade book application so that it drops each students lowest score when determing the test scre averages and letter grades.
grade book application:
#include
#include
#include
using namespace std;
char letterGrade(double score);
int main()
{
char names[5][25]; //student names
char grades[5]; //letter grades
double scores[5][4]; //test scores
double avgScore[5]; //average of 4 test scores
for(int i=0;i<5;i++)
{
cout<<" Enter student "<<(i+1)<<" name: ";
cin>>names[i];
cout<<"Enter his 4 scores: ";
for(int j=0;j<4;j++)
{
cin>>scores[i][j];
while(scores[i][j] > 100 || scores[i][j] <0)
{
cout<<" test score should between 0 and 100"< cout<<"enter test score: "; cin>>scores[i][j]; } } } //finding average score of each student //and letter grade for(int i=0;i<5;i++) { avgScore[i] = 0; for(int j=0;j<4;j++) avgScore[i] += scores[i][j]; avgScore[i] /= 4; grades[i] = letterGrade(avgScore[i]); } //displaying average test score and letter grade cout<<" Student Name\tAverage Score\tLetter Grade"< for(int i=0;i<5;i++) { cout.setf(ios::fixed,ios::floatfield); cout.precision(2); cout< } return 0; } //return letter grade based on the test score //passed as parameter char letterGrade(double score) { if(score >= 90 && score <=100) return 'A'; else if(score >= 80 && score <90) return 'B'; else if(score >= 70 && score <80) return 'C'; else if(score >= 60 && score <70) return 'D'; else return 'F'; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
