COMP122 Week 6 iLab You are to design a program that will allow some number of g
ID: 1833740 • Letter: C
Question
COMP122Week 6 iLab
You are to design a program that will allow some number of grades (up to a max of 100) to be input by the user. After the data has been collected, your program should calculate and output the mean of the collected data, as well as the letter grades for each number grade.
Design Constraints
1. Use an integer constant of 100 to specify the number of elements in the array you will use to collect the grade information.
2. Do not use any global variables in your program.
3. Declare any arrays you need in your main function and pass the arrays as needed into the functions described below. You will probably need two arrays, one for number grades and one for letter grades.
4. The main function is the only function permitted to do any output to the console!!! Do not do cout operations inside of any other function.
5. Your data collection loop in your main function must allow the user to enter less than 100 grades. It must also make sure that the user does not try to enter more than 100 grades.
6. Each data value entered should be checked to make sure it is between 0 and 100. Any other value entered should be considered invalid and ignored (ie. not counted as a valid input and not stored in an array).
7. Once the data is collected, the number grades array and the number of grades collected must be passed to a function called mean.
8. The mean function must loop through the values in the number grades array, summing them together. The result of the function is the sum divided by the number of grades collected. The result must be returned from the mean function to the main function, where is it output in an appropriate manner (two digits after the decimal point).
9. The main function should then pass the number grades array, the letter grades array, and the number of grades collected to the grades function.
10. The grades function uses a loop to determine the letter grade for each grade in the number grades array and store that letter grade in the letter grades array.
11. Use the following criteria to determine the proper letter grades: 90-100 is an A, 80-89 is a B, 70-79 is a C, 60-69 is a D, and 59 and lower is an F. Each letter grade must be stored in the same position in the letter grade array as its corresponding number grade is stored in the number grades array. The grades function does not return a value.
12. The main routine should output the median value in an appropriate manner.
13. The main routine should also output a table that lists all grades in this manner: Each line of output should display a position number starting with 1, the number grade for that position and the letter grade for that position. Keep in mind array indexes start with 0 rather than 1.
Explanation / Answer
Here is the code below: //Header file section #include using namespace std; //Declare functions double MeanFunction(int[], int); double MedianFunction(int[], int); //Start main method int main() { /*Use an integer constant of 100 to specify the number of elements in the array you will use to collect the grade information.*/ const int MAX=100; //Declare variables int grade[MAX], size; double mean,median; /*Prompt the input the number of grades from the user*/ coutsize; if(sizeMAX) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.