Lab8 - import apsc142.*; /* Emilie Courtemanche Simon Wu...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import apsc142.*; /* Emilie Courtemanche Simon Wu Section O Section O 459 7274 454 5302 */ // Assignment 6. This is the modification of lab 9. // The purpose of this assignment is to develop a method that will calculate the slope, the y-intercept and // correlation coefficient of the fit using different methods, arrays and file input. public class Lab8 { public static double addition (double ArrayA [], int MAXN) { double sum = 0; for (int x = 0 ; x <= (MAXN - 1) ; x++) { sum = sum + ArrayA [x]; } return sum; } //THis first method calculates the sum of the array. public static double square (double ArrayA [], int MAXN) { double sum = 0; for (int x = 0 ; x <= (MAXN - 1) ; x++) { sum += Math.pow (ArrayA [x], 2); } return sum; } // This second method claculates the sum of the square of the values in the array a public static double [] multiply (double ArrayA [], double ArrayB [], int MAXN) { double ArrayC [] = new double [MAXN]; for (int x = 0 ; x <= (MAXN - 1) ; x++) { ArrayC [x] = ArrayA [x] * ArrayB [x]; } return ArrayC; } // THis method multiplies the first and second array together and then places
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/01/2010 for the course APPLIED SC 142 taught by Professor Professorstansimmons during the Winter '10 term at Queens University.

Page1 / 3

Lab8 - import apsc142.*; /* Emilie Courtemanche Simon Wu...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online