Consider the following program that reads students’ test scores into an array and prints the contents of the array. You will add more functions to the program. The instructions are given below. For each of the following exercises, write a function and make the appropriate function call in main. Comments are to be added to the program.
Consider the following
For each of the following exercises, write a function and make the appropriate function call in main.
Comments are to be added to the program.
- Write a void function to find the average test score for each student and store it in an array studentAvgs.
void AverageScores( const int scores[][MAX_TESTS],
int numberOfStudents,
int numberOfTests,
double studentAvgs[]);
2. Write a void function to find the average score on each test and store in an array testAvgs.
3. Write a void function to print the average score for each student, i.e. print the contents of the array studentAvgs. The output will be well formatted and accompanied with appropriate messages.
4. Write a void function to print the average score on each test, i.e. print the contents of the array testAvgs. The output will be well formatted and accompanied with appropriate messages.
5. Add the following declaration for the array studentsPassing in the function main.
bool studentsPassing[MAX_STUDENTS];
6. Write a function that initializes all components of the array studentsPassing to false. The array studentsPassing is a parameter.
void Initialize(bool studentsPassing[],int numberOfStudents)
7. Write a function that has studentsPassing , studentAvgs, and numberOfStudents as parameters. Set the components of passing to true whenever the corresponding value in studentAvgs is greater than or equal to 50.0
8. Write a function that has studentsPassing as parameter and print the number of students who passed, i.e. count and print the number of components in studentsPassing that are true. It will also print which students passed. Display meaningful messages.
9. Write a function that has studentAvgs and numberOfStudents as parameters, and determine the highest average score of the class. This value and the student number with this value will be formatted and printed with an appropriate message.
10. Complete the program with the functions and the appropriate function calls. Run the program using the following test data:
Number of students : 5
Number of tests: 4
The test scores for the 5 students:
(note that each row represents the four test scores for one student)
69 80 90 95
70 90 65 85
50 50 60 60
40 45 30 50
25 35 45 49
Note: Your program will have good layout following the guidelines for program layout. It will also have appropriate comments and function headers with good description.
Run the program again using at least two other data sets using a different number of students and tests for each test run.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images