Purchase Solution

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

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Solution Summary

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

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);
int calculateGrade(double avg);

void main()
{
string studentName;
double test1, test2, test3, test4, test5;
double average=0.0;
char grade;
int studentCount=0;
double sumAverage=0.0;
double cAverage=0.0;
int ...

Purchase this Solution


Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.