Question: public class Hw6_Ex1 { public static void main(String[] args) { double[] x = new double[] {23.11, 10.71, 26.98, 28.68, 23.57, 25.15, 24.86, 17.84, 23.11, 13.42};

public class Hw6_Ex1 { public static void main(String[] args) { double[] x = new double[] {23.11, 10.71, 26.98, 28.68, 23.57, 25.15, 24.86, 17.84, 23.11, 13.42}; double[] y = new double[] {262, 428, 185, 162, 217, 237, 230, 325, 267, 382 }; int n = y.length; double xSum = 0; double ySum = 0; for(int i =0;i

Please use the following to:

public class Hw6_Ex1 { public static void main(String[] args) { double[] x

Create a method that: Takes two parameters: (1) an array for X, (2) an array for Y; Returns a double value, which is the correlation coefficient r between X and Y In your method, calculate r using the formulas given above. In your main method, perform the same tasks as in the previous homework: (i) Define two arrays to hold the prices and sales, and initialize them by typing in the numbers; (ii) Call the method you just created, passing in the two arrays as parameters, to calculate the correlation coefficient. (iii) Output the value of r (display 4 decimal places only). Your program should run as follows: C. Command Prompt C:\test>javac Hw6_Ex2.java C:\test/java Hw6 Ex2 Correlation Coefficient: -0.9874 C:\test>

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!