Programming Assignment
A Grading Problem
Write a program which calculates students' scores.
A student is given four exams. The final grade of each student is determined by calculating the weighted average of all the exams.
In a loop your program should do the following (you can use a do/while):
- receive as data input the weights (proportions) for the four exam grades, and put these into an array called weights.
- Read in 4 test grades into another array called grades.
-
Use the following test data for one example:
-
weights for exams: .10, .20, .25, .45
- first student record: 75, 87, 79, 92
- make up the rest yourself.
- call the function isitvalid() passing in the grades array, the function returns a bool (i.e. a boolean value).
- The function isitvalid() will determine whether or not the values in this array are valid. It will return true/1 for valid and false/0 if it's invalid. The function will return invalid if any grade in the array is not a valid grade (i.e. it's greater than 100 or less than 0). If the function returns false, your main program should read 4 values into the grades array again.
- You should calculate and print the final grade, which is the weighted average.
- Next your program will allow the user to see the any number of their test scores. For example. Your program can display a message such as: "If you don't believe the score is correct, how many of your grades would you like to see?", and it should call a function printarray() which takes two parameters, the array, and the number of grades the user would like to see..
- The function printarray() does not return anything, it will print out the number of grades the user would like to see. For example if the user passed the number 2, it will print the first two grades from the grades array.
- Your program will ask the user if s/he would like to enter another student.
At the end of your program, you should print the class average i.e. the average of all the final grades combined.
Hand in your program, and input and output