| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- /**
- * @author (Jakob Kienegger)
- * @version (27.04.19)
- */
- import java.io.*;
- import java.util.*;
- public class Eingabe
- {
- private Element[][] matrix;
- private double multi = 1;
- private int n;
- private int m;
-
- public Eingabe() throws IOException
- {
- n = 3;
- m = 4;
- }
-
- public void einlesen(int dim_m, int dim_n) throws IOException
- {
- m = dim_m;
- n = dim_n;
- for(int i=0; i<n; i++)
- {
- for(int j=0; j<m; j++)
- {
- InputStreamReader isr = new InputStreamReader(System.in);
- BufferedReader br = new BufferedReader(isr);
- System.out.print( + i + "," + j + ": ");
- String eingabe = br.readLine();
- matrix[j][i] = new Element(Double.parseDouble(eingabe));
-
- }
-
- }
-
- }
- public double faktorCheck(Element zahl)
- {
- if(zahl.gibZahl() != 1)
- {
- multi = 1/(zahl.gibZahl());
- zahl.multiZahl(multi);
- }
- return multi;
- }
-
- public double rechnen(Element zahl, double multi)
- {
- zahl.multiZahl(multi);
- return zahl.gibZahl();
- }
-
- public void zeilenFaktor(int a)
- {
- for(int i=0; i<n; i++)
- {
- this.multi = faktorCheck(matrix[i][a]);
- for(int j=1; j<m; j++)
- {
- matrix[i][j].multiZahl(this.multi);
- }
- }
-
- }
-
- public void ausgabe()
- {
- for(int j=0; j<n; j++)
- {
- for(int i=0; i<m; i++)
- {
- System.out.print( matrix[j][i].gibZahl() + ", ");
- }
-
- }
- }
-
-
- public void gauss() throws IOException
- {
- einlesen(m, n);
- zeilenFaktor(0);
- for(int j=1; j<3; j++)
- {
- for(int i=0; i<m; i++)
- {
- double a = matrix[0][i].gibZahl();
- double b = matrix[j][i].gibZahl();
-
- matrix[j][i].changeZahl(b-a);
- }
- }
- zeilenFaktor(1);
- for(int i=1; i<m; i++)
- {
- double a = matrix[1][i].gibZahl();
- double b = matrix[0][i].gibZahl();
-
- matrix[0][i].changeZahl(b-a);
- }
- for(int i=1; i<m; i++)
- {
- double a = matrix[1][i].gibZahl();
- double b = matrix[2][i].gibZahl();
-
- matrix[2][i].changeZahl(b-a);
- }
- zeilenFaktor(2);
- for(int j=0; j<2; j++)
- {
- for(int i=2; i<m; i++)
- {
- double a = matrix[2][i].gibZahl();
- double b = matrix[j][i].gibZahl();
-
- matrix[j][i].changeZahl(b-a);
- }
- }
- ausgabe();
- }
-
- /*
-
- */
-
-
- }
|