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

Need to modify to drop the lowest score, every thing I try gives an error. Here

ID: 3633052 • Letter: N

Question

Need to modify to drop the lowest score,
every thing I try gives an error.  Here is my code ---- http://pastebin.com/raw.php?i=s3jSL0WB

It should be something like:

double getLowest(const double array[], int size)
{
double lowest; // To hold the lowest value

// Get the first array's first element.
lowest = array[0];

// Step through the rest of the array. When a
// value less than lowest is found, assign it
// to lowest.
for (int count = 1; count < size; count++)
{
if (array[count] < lowest)
lowest = array[count];
}

// Return the lowest value.
return lowest;
}

////////////////////////////////////////

 

//function prototype

 

char letterGrade(double score);

 

//main function

 

 

           }

         }

      }

    //finding average score of each student

     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;

 

         //function call to calculate grade

        grades[i] = letterGrade(avgScore[i]);

    }

    //displaying average test score and letter grade 

    cout<<" Student Name Average Score

                               Letter Grade"<<endl;

 

 

char letterGrade(double score)

 

{

 

Explanation / Answer

i think now i understand the problem statement. This should work.

#include
#include
#include
using namespace std;
//function prototype
char letterGrade(double score);
double getLowest(const double array[], int size);
//main function
int main()
{
char names[5][25]; //student names
char grades[5]; //letter grades
double scores[5][4]; //test scores
double lowest;
int lowest_scorer;
double avgScore[5]; //average of 4 test scores
//inputting student name and test
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];
//validating test score
while(scores[i][j] > 100 || scores[i][j] <0)
{
cout<<" test score should be in
between 0- 100"< cout<<"enter test score: ";
cin>>scores[i][j];
}
}
}
//finding average score of each student
for(int i=0;i<5;i++)
{
lowest =100;
lowest_scorer=-1;
for (int j=0;j<4;j++)
{
if(scores[i][j]<=lowest)
{
lowest=scores[i][j];
lowest_scorer = j;
}
}
avgScore[i] = 0;
for(j=0;j<4;j++)
{
if(j!=lowest_scorer)
avgScore[i] += scores[i][j];
}
avgScore[i] /= 3;

//function call to calculate grade
grades[i] = letterGrade(avgScore[i]);
}
//displaying average test score and letter grade
cout<<" Student Name Average Score
Letter Grade"< for(int i=0;i<5;i++)
{
cout.setf(ios::fixed,ios::floatfield);
cout.precision(2);
cout< < }
system("pause");
}
//grade value passed as parameter and returns
//character grade
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';
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote