Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 <iostream>

#include <string>

#include <iomanip>

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<<"\nEnter 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<<"\ntest score should between 0 and 100"<<endl;

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<<"\nStudent Name\tAverage Score\tLetter Grade"<<endl;

  

for(int i=0;i<5;i++)

  

{

  

cout.setf(ios::fixed,ios::floatfield);

  

cout.precision(2);

  

cout<<names[i]<<"\t\t"<<setprecision(2)<<avgScore[i]<<"\t\t"<<grades[i]<<endl;

  

}

  

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

Step: 1

Modified Code Modify the grade book application so that it drops each students lowest score wh... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mathematical Statistics With Applications In R

Authors: Chris P. Tsokos, K.M. Ramachandran

2nd Edition

124171133, 978-0124171138

More Books

Students also viewed these Programming questions

Question

Explain how to become a Magnet-certified hospital.

Answered: 1 week ago