Question: Follow these detailed instructions: First, read this document in its entirety. Include the usual (detailed) comment block including program name, author, date, inputs, outputs and

 Follow these detailed instructions: First, read this document in its entirety.

Follow these detailed instructions:

First, read this document in its entirety.

Include the usual (detailed) comment block including program name, author, date, inputs, outputs and description, followed by your preprocessor directives.

An outline (Skeleton-code) of the source code is shown below and you are REQUIRED to follow this outline. Insert appropriate printf statements where needed to get the desired output. Declare and use variables as you require them. The outline has five sections where you are to enter in your code and complete the program.

Part 1: Open two files for input and read the data into two arrays (x and y). Include all appropriate error checks. You may assume that your input files will never exceed 200 floating point numbers and that both x data and y data files will be of equal length, so once you know the length of one file in the pair you can assume that the other file is of the same length.

Part 2: You are required to write the function called sum which accepts an array, and a parameter named size which indicates the size of the array. This function calculates the sum of the elements in the array and returns it to the calling function. Call this function once with the x data and once with the y data and print out the results to the screen from calling function.

Part 3: You are required to write the function call sum_prod which accepts two arrays, and a parameter named size which indicates the size of the arrays. This function calculates the sum of the product of corresponding elements in the two arrays i.e. array1[0]*array2[0]+array1[1]*array2[1]+array1[N-1]*array2[N-1]. The sum is then returned to the calling function and the result is printed to the screen.

Part 4: You are required to write the function call sum_square which accepts an array, and a parameter named size which indicates the size of the array. This function calculates the sum of the square of each array element i.e. (array1[0])2 + (array1[1])2 + (array1[N-1])2. Call this function once with the x data and once with the y data and print out the results to the screen from calling function.

EXTRA CREDIT: Part 5: Calculate the correlation coefficient, r, in main()and display the result to the screen.

This is a beginner coding class! Please do not use too complicated stuff and comments help me understand what you are doing. Thank you! IN C PROGRAMMING

Problem: Write a C program to find the following given two data sets, x and y N-1 N-1 N-11,2 Extra credit: Find the correlation coefficient, r, between two data sets, x and y, using the equation below: OUTPUT TABLE Sum of squares Sum of products EXTRA CREDIT:r Filename Sum datax.txt datay.txt

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!