Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions