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

Lowest Score Drop Write a program that calculates the average of a group of test

ID: 3624414 • Letter: L

Question

Lowest Score Drop

Write a program that calculates the average of a group of test scores, where the lowest
score in the group is dropped. It should use the following functions:
• void getScore () should ask the user for a test score, store it in a reference
parameter variable, and validate it. This function should be called by main once
for each of the five scores to be entered.
• void calcAverage() should calculate and display the average of the four highest
scores. This function should be called just once by main, and should be passed
the five scores.
• .int:. findLowest:.() should find and return the lowest of the five scores passed to
it. It should be called by calcAverage, which uses t he function to determine which
of the five scores to drop.

Input Validation: Do 1lot accept test scores lower than 0 or higher than 100.

Explanation / Answer

please rate - thanks

#include <iostream>
using namespace std;
void getScore(int&);
void calcAverage(int,int,int,int,int);
int findLowest(int,int,int,int,int);
int main()
{int n1,n2,n3,n4,n5;
getScore(n1);
getScore(n2);
getScore(n3);
getScore(n4);
getScore(n5);
calcAverage(n1,n2,n3,n4,n5);
system("pause");
return 0;
}
void getScore(int& num)
{do
{cout<<"enter a number: ";
cin>>num;
if(num<0||num>100)
   cout<<"number out of range-try again ";
}while(num<0||num>100);
return;
}
void calcAverage(int n1,int n2,int n3,int n4,int n5)
{double average;
int low,total;
low=findLowest(n1,n2,n3,n4,n5);
total=n1+n2+n3+n4+n5-low;
average=total/4.;
cout<<"The average of the top 4 grades is "<<average<<endl;
return;
}

int findLowest(int n1,int n2,int n3,int n4,int n5)
{int low;
low=n1;
if(n2<low)
   low=n2;
if(n3<low)
   low=n3;
if(n4<low)
   low=n4;
if(n5<low)
   low=n5;
return low;
}