Assignment555 - counter++; } } } } return matT[row][col]; }...

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

View Full Document Right Arrow Icon
// The "Assignment555" class. public class Assignment555 { int totlCols = 10; int totlRows = 10; // Precondition: matT is already initialized public static double calcTemp(double matT[][], int row, int col){ double acceptable = 0.01; double newValue; int counter = 0; i while(counter < 10*10){ for(row = 0; row < 10; row++){ for(col = 0; col < 10; col++){ f if(row == 0 || row == 10 - 1 || col == 0 || col == 10 - 1 || counter++; else{ newValue = (matT[row+1][col] + matT[row-1][col] + matT[row] [col+1] + matT[row][col-1])/4; if((matT[row][col]-newValue) <= acceptable )
Background image of page 1

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

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

Unformatted text preview: counter++; } } } } return matT[row][col]; } public static double initialize (){ double matT = new double [10][10]; for(int row = 0; row &lt; 10; row++){ for(int col = 0; col &lt; 10; col++){ if(row == 0 || row == 10 - 1 || col == 0 || col == 10 - 1) matT[row][col] = 20.0; else if(row == 2 &amp;&amp; col == 7) matT[row][col] = 100.0; else matT[row][col] = 50.0; } } return matT; } public static void main (String args){ double matT=new double [10][10]; matT = initialize(); m } } // Assignment555 class }...
View Full Document

Page1 / 2

Assignment555 - counter++; } } } } return matT[row][col]; }...

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