Eingabe.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * @author (Jakob Kienegger)
  3. * @version (27.04.19)
  4. */
  5. import java.io.*;
  6. import java.util.*;
  7. public class Eingabe
  8. {
  9. private Element[][] matrix;
  10. private double multi = 1;
  11. private int n;
  12. private int m;
  13. public Eingabe() throws IOException
  14. {
  15. n = 3;
  16. m = 4;
  17. }
  18. public void einlesen(int dim_m, int dim_n) throws IOException
  19. {
  20. m = dim_m;
  21. n = dim_n;
  22. for(int i=0; i<n; i++)
  23. {
  24. for(int j=0; j<m; j++)
  25. {
  26. InputStreamReader isr = new InputStreamReader(System.in);
  27. BufferedReader br = new BufferedReader(isr);
  28. System.out.print( + i + "," + j + ": ");
  29. String eingabe = br.readLine();
  30. matrix[i][j] = new Element(Integer.parseInt(eingabe));
  31. }
  32. }
  33. }
  34. public double faktorCheck(Element zahl)
  35. {
  36. if(zahl.gibZahl() != 1)
  37. {
  38. multi = 1/(zahl.gibZahl());
  39. zahl.multiZahl(multi);
  40. }
  41. return multi;
  42. }
  43. public double rechnen(Element zahl, double multi)
  44. {
  45. zahl.multiZahl(multi);
  46. return zahl.gibZahl();
  47. }
  48. public void zeilenFaktor()
  49. {
  50. for(int i=0; i<n; i++)
  51. {
  52. this.multi = faktorCheck(matrix[i][0]);
  53. for(int j=1; j<m; j++)
  54. {
  55. matrix[i][j].multiZahl(this.multi);
  56. }
  57. }
  58. }
  59. /*
  60. public void gauss() throws IOException
  61. {
  62. einlesen(m, n);
  63. zeilenFaktor();
  64. for(int i=0; i<
  65. }
  66. /*
  67. */
  68. }