Question: function and file data Write a C++ program that will calculate student grades up to 2 decimal positions after any whole numbers for rounding purposes.
function and file data
Write a C++ program that will calculate student grades up to 2 decimal positions after any whole
numbers for rounding purposes.
a. Create the following input file and call it Lab7inpt.dat
Student # Test 1 Test2 Labs Final
111 70 80 90 98
222 90 80 77 65
333 100 95 80 90
444 67 60 75 70
555 88 69 85 71
666 78 98 82 77
777 45 56 67 60
888 70 89 88 75
999 85 90 81 80
100 55 75 93 95
200 93 71 75 82
300 76 93 87 98
b. Do not put the first line shown above here in the file
You should read the input file until EOF is reached and count how many records you read in. This count will be needed for statistical calculations later on in this lab.
Write a function that will calculate a final number grade using the formula:
Final Number Grade = (0.20 * Test 1) + (0.20 * Test 2) +
(0.35 * Labs) + (0.25 * Final Exam)
Write another function that will determine the final letter grade based on each final number grade. A final letter grade is based on the following ranges: 90 - 100 = A, 80 - 89 = B, 70 - 79 = C, 60 - 69 = D, less than 60 = F.
f. Write another function to print all student information including new columns for the final numeric grade and the final letter grade.
Write a function that will determine the statistical mean (which is a standard average
based on how many records were counted when they were read in) from the data in the final number grades and place the results of this calculation as the last line of the above generated report file. Put an appropriate subheading to describe what the value calculated represents.
h. Points to remember:
(1) You will have to determine what variables to pass by value and what
variables to pass by reference.
Remember that functions can call other functions!
Global variables CANNOT BE USED in this lab assignment.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
