In this assignment you have to write a program for an instructor that has 5 exam scores during the semester. The exam score is between 0 and 100 inclusive. Fractional exam scores, such as 88.5, are allowed. A student's final average exam score is determined by dropping the highest and lowest exam score, then averaging the 3 remaining exam score is the final grade. Write a program that calculates the average exam score. It should include the following functions:

Function prototype Description
void getExam(double &) Should ask the user for an exam score and store it in a reference parameter variable, and validate the score. This function should be called by main one for each of the 5 exam scores. It should check for exam escores between 0 and 100 inclusive.
void calcAverage(double, double, double, double, double) Should calculate and display the average of the 3 exam scores that remain after dropping the highest and lowest exam scores the student has received. This function should be called just once by main, and should be passed the 5 exam scores.
double findLowest(double, double, double, double, double) This function should find and return the lowest of the 5 exam scores passed to it. This function should be called by calcAverage, which uses the returned information to determine which of the lowest exam scores to drop.
double findHighest(double, double, double, double, double) This function should find and return the highest of the 5 exam scores passed to it. This function should be called by calcAverage, which uses the returned information to determine which of the highest exam scores to drop.

Helpful hints for doing this assignment:

  • work on it in steps - write one function, test it and make sure it works before going on to the next function
  • always make sure your code compiles before you add another function
  • your functions should be able to be called in any order
  • compile your work frequently to avoid too many errors at one time.
  • verify the parameter lists in the prototype, the call, and the header for each function. Errors here will appear only when your build, not when you compile.

Program requirements and/or constraints:

  • Ceate your plan BEFORE you begin to write the code.
  • Think carefully about each functions the return value and arguments passed to it.
  • Choose appropriate descriptive names for all the identifiers.
  • No global variables.
  • Use comments freely throughout the program.
  • Your program must work for any valid input - not just the values shown in the sample output.

Sample output:

Enter exam score between 0 and 100: 85
Enter exam score between 0 and 100: 90
Enter exam score between 0 and 100: 78
Enter exam score between 0 and 100: 82
Enter exam score between 0 and 100: 70

The student's average exam score is 81.67
Do you want to enter the exam for another student?
Enter y or n: y

Enter exam score between 0 and 100: 120
Exam score must be in the range 0-100. Please re-enter exam score: 76
Enter exam score between 0 and 100: 76
Enter exam score between 0 and 100: 76
Enter exam score between 0 and 100: 76
Enter exam score between 0 and 100: 76

The student's average exam score is 76.00
Do you want to enter the exam for another student?
Enter y or n: y

Enter exam score between 0 and 100: -10
Exam score must be in the range 0 - 100. Please re-enter exam score: 100
Enter exam score between 0 and 100: 0
Enter exam score between 0 and 100: 80
Enter exam score between 0 and 100: 90
Enter exam score between 0 and 100: 70

The student's average exam score is 80.00
Do you want to enter the exam for another student?
Enter y or n: y

Enter exam score between 0 and 100: 87
Enter exam score between 0 and 100: 89
Enter exam score between 0 and 100: 82
Enter exam score between 0 and 100: 92
Enter exam score between 0 and 100: 76

The student's average exam score is 86.00
Do you want to enter the exam for another student?
Enter y or n: n
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.