Explore BrainMass

# program that reads a student's name together with his or her test scores.

Not what you're looking for? Search our solutions OR ask your own Custom question.

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Write a program that reads a student's name together with his or her test scores. The program should then compute the average test scores for each student and assign the appropriate grade. The grade scale is as follows: 90-100, A; 80-89, B; 70-79, C; 60-69, D; 0-59, F.

Your program must use the following functions:

1. A void function, calculateAverage, to determine the average of the five test scores for each student. Use a loop to read and sum the five test scores. (This function does not output the average test score. That task must be done in the function main.)

2. A value-returning function, calculateGrade, to determine and return each student's grade. (This function does not output the grade. That task must be done in the function main.)

Test your program on the following data. Read the data from a file and send the output to a file. Do not use any global variables. Use the appropriate parameters to pass value in and out of functions.

Please see attached for full question.

#### Solution Preview

calculateAverage, to determine the average of the five test scores for each student has to be int or double value returning function. Because it will return the average value to the main function.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;

double calculateAverage(double test1, double test2, double test3, double test4, double test5);

void main()
{
string studentName;
double test1, test2, test3, test4, test5;
double average=0.0;