Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Controller: //Step 3.1 // Uncomment the header code below // header code // System.out.println(); // System.out.println(===========================================); // System.out.println(Data Stats); // System.out.println(===========================================); // end header code

image text in transcribedimage text in transcribed

Controller:

//Step 3.1 // Uncomment the header code below // header code // System.out.println(""); // System.out.println("==========================================="); // System.out.println("Data Stats"); // System.out.println("==========================================="); // end header code // use the Analyzer class to calculate the average of the data's // SP500 values // Hint: think here a lot of stuff is going on here..... // COMPLETE THE CODE BELOW // System.out.printf("Average SP500: \t %-10.2f " YOUR CODE HERE // end step 3.1

//Step 3.3 // use the Analyzer class to calculate the variance of the data's // SP500 values // Hint: think here a lot of stuff is going on here..... // COMPLETE THE CODE BELOW // System.out.printf("Variance SP 500: %-10.2f " YOUR CODE HERE

//end step 3.3 //Step 3.5 // use the Analyzer class to calculate the variance of the data's // SP500 values // Hint: think here a lot of stuff is going on here..... // COMPLETE THE CODE BELOW // System.out.printf("Std Dev SP 500: \t %-10.2f " YOUR CODE HERE

//end step 3.5

Analyzer:

// Step 3 // use an enhance for loop to add up at the elements of the arraylists // DO NOT USE A NORMAL FOR LOOP // YOUR CODE HERE // calculate the average value // YOUR CODE HERE // end Step 3 return average; } public static double variance(ArrayList data){ // calculate the SAMPLE Variance // you need to divide by (n-1) not by n double average = average(data); double sum = 0.0; double variance = 0.0; // Step 3.2 // calculate the sample variance using the formula given // in the instruction document // HINT: use the Math class // YOUR CODE HERE // end Step 3.2 return variance; } // Step 3.4 public static double standardDeviation(ArrayList data){ double stdDev = 0.0; // calculate the standard deviation using the formula given // in the instruction document // HINT: use the Math class // YOUR CODE HERE // end Step 3.4 return stdDev; }

Looking at some of the data in the file: DATE,SP500, GOLD, LIBOR 2019-01-02,2510.03,1287.200,2.79388 2019-01-03,2447.89,1287.950,2.79500 2019-01-04,2531.94,1290.350,2.80388 2019-01-07,2549.69,1291.500 2.79681 2019-01-08,2574.41,1283.900,2.78250 2019-01-09,2584.96,1281.300,2.79888 2019-01-10,2596.64,1292.400,2.79694 2020-08-07,3351.28,2061.500,0.25250 2020-08-10,3360.47,2030.300,0.25688 2020-08-11,3333.69,1996.600,0.25350 2020-08-12,3380.35,1931.700,0.26475 Step 3: n 72 n-1 In the Analyzer.java file complete the code for Step 3 This code calculates the average. The formula for average: 7 = -2 21=1*; In the Controller.java file complete the code for Step 3.1 In the Analyzer.java file complete the code for Step 3.2 o This code calculates the variance. The formula for sample variance: 22=1 son (x-3)2 In the Controller.java file complete the code for Step 3.3 In the Analyzer.java complete file the code for Step 3.4 o This code calculates the standard deviation. The formula for sample variance: Sx = yn (x-2) In the Controller.java complete the code for Step 3.5 L=1 n-1 Looking at some of the data in the file: DATE,SP500, GOLD, LIBOR 2019-01-02,2510.03,1287.200,2.79388 2019-01-03,2447.89,1287.950,2.79500 2019-01-04,2531.94,1290.350,2.80388 2019-01-07,2549.69,1291.500 2.79681 2019-01-08,2574.41,1283.900,2.78250 2019-01-09,2584.96,1281.300,2.79888 2019-01-10,2596.64,1292.400,2.79694 2020-08-07,3351.28,2061.500,0.25250 2020-08-10,3360.47,2030.300,0.25688 2020-08-11,3333.69,1996.600,0.25350 2020-08-12,3380.35,1931.700,0.26475 Step 3: n 72 n-1 In the Analyzer.java file complete the code for Step 3 This code calculates the average. The formula for average: 7 = -2 21=1*; In the Controller.java file complete the code for Step 3.1 In the Analyzer.java file complete the code for Step 3.2 o This code calculates the variance. The formula for sample variance: 22=1 son (x-3)2 In the Controller.java file complete the code for Step 3.3 In the Analyzer.java complete file the code for Step 3.4 o This code calculates the standard deviation. The formula for sample variance: Sx = yn (x-2) In the Controller.java complete the code for Step 3.5 L=1 n-1

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions