1 - import apsc142.*; public class Assignment5a cfw_ public...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 import apsc142.* public class Assignment5a { public static void printArray(double matT[][]){ for(int row = 0 for(int col = 0 System.out.print("[" + matT[row][col] + "] ") } System.out.print("\n") } } public static double abs(double a, double b){ double greater, lesser if(a > b){ greater = a lesser = b } else{ greater = b lesser = a } return greater - lesser } public static void initialize (double matT[][]){ int x int y int set for (x = 0 for (y = 0 matT[x][y]=50 } } for (set = 0 matT[0][set]=20 matT[set][0]=20 matT[9][set]=20 matT[set][9]=20 } matT[2][7]=100 } /*public static double calcTemp(double matT[][], int i, int j){ double acceptable = 0.01
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sheet1 Page 2 double newValue int counter=0 printArray (matT) //while(counter < 100 ){ for (int counter2 = 0 counter = 0 for(int x = 0 for(int y = 0 counter++ else{ newValue = (matT[x+1][y] + matT[x-1][y] + matT[x][y+1] + matT[x][y-1])/4 if (( abs(matT[x][y],newValue )) <= acceptable )
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

1 - import apsc142.*; public class Assignment5a cfw_ public...

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

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