File General.java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Scanner;
public class General {
public static void main(String[] args) {
// Чтение входных данных
System.out.println("Введите высоту матрицы");
Scanner in = new Scanner(System.in);
int rows = in.nextInt();
Double[][] arr = new Double [rows][rows+1];
Double[] iter = new Double[rows];
for (int i = 0; i < rows; i++){
for (int j = 0; j < rows + 1; j++){
System.out.println("Введите a[" + i + "][" + j + "]");
arr[i][j] = in.nextDouble();
}
}
System.out.println("Введите точность");
Double eps = in.nextDouble();
for (int i = 0; i < rows; i++){
for (int j = 0; j < rows + 1; j++){
System.out.print(arr[i][j]+ " ");
}
}
SimpleIterator Matrix = new SimpleIterator(eps, rows);
arr = Matrix.Normalization(arr);
boolean flag = Matrix.Convergence(arr);
int sp = Matrix.Iteration(eps);
System.out.println(sp);
}
}