Write a program that reads a student's name, together with his or her test scores for at most 50 students from a file, provided by users of your program. The program should then compute the average test score for each student and assign the appropriate grade. The grade scale is as the follows:

  • 90 <= average < 100, A;
  • 80 <= average < 90 B;
  • 70 <= average < 80, C;
  • 60 <= average < 70, D;
  • average < 60, F.

The program also calculates the class average.

There is a test file, prog7_input.txt,you may use for testing. The following are a few examples you may find in the file

Johnson 85 83 77 91 76
Aniston 80 90 95 93 48
Cooper 78 81 11 90 73
Gupta 92 83 30 69 87
Blair 23 45 96 38 59
Clark 60 85 45 39 67
Kennedy 77 31 52 74 83
Bronson 93 94 89 77 97
Sunny 79 85 28 93 82
Smith 85 72 49 75 63

But, your program must prompt the name of the actual input file which is determined at run time by users.

In the program, you must use four arrays:

  • a one-dimensional array to store the students' names,
  • a parallel two-dimensional array to store the test scores,
  • a parallel one-dimensional array to store the students' averages, and
  • a parallel one-dimensional array to store the grades.

Your program must contain at least the following functions:

  • readScore( ) -- to read and store data into arrays;
  • calcAverage( ) -- calculate the average test score and grade and save them to arrays;
  • writeReport( ) -- function to output the results to the screen ( not an output file).

You may declare global constants, but do not use any global variable. Use the appropriate parameters to pass values in and out functions.

The output should be displayed on the screen in the form as following sample output: ( Fill the last two columns with student's average and grade, and the bottom line with the class average.) Round the averages to one decimal place.

A sample output is shown on next page. See image.

Here, the question marks mean you have to fill these columns with calculation results. Print the output in the alphabetic order of students' names.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only 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 fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.