# assignment5 - matT[i][j]= Temp } } } return matT[4][4] }...

This preview shows pages 1–4. Sign up to view the full content.

Sheet1 Page 1 import apsc142.* public class Assignment5 { public static double calcTemp(double matT[][], int i, int j){ for (i = 0 i<matT.length for (j = 0 j<matT[0].length if ((i==0)||(i==10)) matT [i][j]=20 if ((j==0)||(j==10)) matT [i][j]=20 else matT [i][j]=50 } } matT[2][7] = 100 for (i=1 i<matT.length-1 for (j=1 j<matT[0].length-1 if (matT[i][j]!= 100){ double Temp = 1/4*(matT[i+1][j]+matT[i-1][j]+matT[i][j+1]+matT[i][j-1]) if (Temp-matT[i][j] >= 0.01)

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: matT[i][j]= Temp } } } return matT[4][4] } public static void initialize (double matT){ double matT = new double [10][10] System.out.println (&quot;Please enter the location of temperature that you want:&quot;) System.out.println (&quot;The temperature at 4,4 is: &quot; +calcTemp+ &quot;.&quot;) StdIn calcTemp = new StdIn () } Sheet1 Page 2 } // Assignment5 class Sheet1 Page 3 i++){ j++){ i++){ j++){ Sheet1 Page 4...
View Full Document

## assignment5 - matT[i][j]= Temp } } } return matT[4][4] }...

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

View Full Document
Ask a homework question - tutors are online