Question: 1. Implement a function named calculateMean(). This function takes two parameters, an integer indicating the size of the array of values (n), and an array

1. Implement a function named calculateMean(). This function takes two parameters, an integer indicating the size of the array of values (n), and an array of integers. This function will return a value of type double.

2. Implement a second function named calculateStandardDeviation(). This function takes the same two parameters, the size of the array of values (n) and and array of integers. This function will also return a double result. The function will calculate and return the standard devation of any array of integers of any size passed to it. Some further requirements of this function. You must demonstrate the use of prede- ned functions from such as the pow() and sqrt() functions. 2 Also, you must call the calculateMean() function from this function, e.g. do not repeat the calculation of the mean value, but reuse your previous function to do this work to obtain x. Here is the correct output you get from your program if you correctly implement the two functions and use the array given to you in the starting template for this assignment:

The calculated mean is: 5.6363636

The calculated standard deviation is: 2.6206428

/** main * The main entry point for this program. Execution of this program * will begin with this main function. * * @param argc The command line argument count which is the number of * command line arguments provided by user when they started * the program. * @param argv The command line arguments, an array of character * arrays. * * @returns An it value indicating program exit status. Usually 0 * is returned to indicate normal exit and a non-zero value * is returned to indicate an error condition. */ int main(int argc, char** argv) { int n = 22; int x[] = {5, 8, 3, 7, 9, 2, 7, 5, 4, 5, 2, 1, 9, 8, 9, 3, 5, 2, 5, 8, 8, 9}; double xbar; double std;

// calculate and display mean of values //xbar = calculateMean(n, x); cout << "The calculated mean is: " << setprecision(8) << xbar << endl;

// calculate and display standard deviation of values //std = calculateStandardDeviation(n, x); cout << "The calculated standard deviation is: " << setprecision(8) << std << endl; // return 0 to indicate successful completion return 0; }

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!