Question: In C++, NOTE: Treat every function as an independent function, wherein each function can take a different array as an input. Part 1 Function call

In C++, NOTE: Treat every function as an independent function, wherein each function can take a different array as an input.

Part 1 Function call to initialize a given array with the given value.

void fillArray(int data[],int size, int value) The fillArray() function will take in three arguments, an array of integers, the size of the array and an integer value with which the array has to be initialized. You should pass the reference of your integer array that you declare in your main function to this function. The function should fill the entire array with the given value. The function does not return any value.

Tip - To test the validity of the function you can print the values of the array in your main function after the function call, to check if the entire array has been initialized correctly. You can follow similar validation steps for all the other functions.

Part 2 Calculate grades of students

In this part, you will calculate the grades of students based on their corresponding scores. Your main program should declare a character array which will hold the grades of students. In the main itself you should create and fill an array of scores which is of float type. While making the function call, you will pass three arguments to this function, i.e. the reference of your scores array, the reference of your grades array and the size of scores array ( size of grades and scores array would be the same) to the calculateGrades() function.

The function does not return any value.

void calculateGrades(float scores[],char grades[],int size)

This function will populate your grades array based on the scores stored in your scores array. The grades should be calculated based on the following rules and stored into your grades array. The array index for the grades in the grades array would be the same as the array index of the corresponding score in the scores array.

For scores greater than and equal to 90 Grade is A

For scores greater than and equal to 80 and lesser than 90 Grades is B

For scores greater than and equal to 70 and lesser than 80 Grades is C

For scores greater than and equal to 60 and lesser than 70 Grades is D

For scores less than 60 Grades is F

Note: Please make sure you test the validity of every function by creating different test arrays in your main program and passing it to these functions. This holds for all the other functions as well.

Tip: You can print out the values of your grades array in your main program to check its correctness.

Part 3 Calculate the average score of class

In this part, you will calculate the average score of the students. The average score is calculated by taking the sum of all the scores of the students and dividing it by the number of students.

float getAverageScore (float scores[], int size) The getAverageScore () function will take two arguments, i.e. the reference of your scores array and the size of the array. The function should return the average score of the students which should be of float type.

Tip - You can print out the returned value of the average score in your main program to check its correctness.

Part 4 Find the minimum score

In this part, you will find the minimum score from your list of scores and return the minimum score to your main function.

float getMinScore(float scores[],int size) The getMinScore () function should take in two arguments, i.e. the reference of your scores array and the size of the array. The function should return the minimum score value which should be of float type.

Tip - You can print out the returned value of the minimum score in your main program to check its correctness.

Part 5 Find the maximum score

In this part, you will find the maximum score from your list of scores and return the maximum score to your main function.

float getMaxScore(float scores[],int size) The getMaxScore () function should take two arguments, i.e. the reference of your scores array and the size of the array. The function should return the maximum score value which should be of float type.

Tip - You can print out the returned value of the maximum score in your main program to check its correctness.

Part 6 Sort the Scores Array

In this part, you will rearrange the scores in your array in ascending order, with the lowest score being at the start of the array and the highest score at the end. You can should use Bubble sort algorithm to sort the array.

void sortScores(float scores[],int size) The sortScores () function will take two arguments, i.e. the reference of your scores array and the size of the array. The function does not return any value.

Tip: You can print out the values of your array in your main program to check if it's sorted correctly.

Part 7 Find the median score.

In this part, you will find the median score from your scores array . You are not allowed to change the order of the elements in the array that you are passing. The median of a sorted list is the middle element of the list.

float getMedian(float scores[],int size) The getMedian function should take two arguments, i.e. the reference of your scores array(which is not sorted) and the size of the array. The function should return the median score of the students which should be of float type.

Tip - You can print out the returned value of the median score in your main program to check its correctness.

Part 8 Count the number of students with a particular grade

In this part, you will count the number of students who have secured a particular grade.

int countGrade(char grades[],char grade, int size)

This function takes in three arguments, i.e. the reference of the grades array, the grade character whose occurrence you want to count and the size of the array. The function should return the count of students who have secured this grade.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!