Hallo,
bin neu in der java-welt und hab ne kleine aufgabe bekommen:
ein programm schreiben, welches 2 matrizzen addieren kann.
hier mal mein anfang, es kommen diverse fehlermeldungen.....
vlt hat jemand ne idee, ich verzweifel langsam
bin neu in der java-welt und hab ne kleine aufgabe bekommen:
ein programm schreiben, welches 2 matrizzen addieren kann.
hier mal mein anfang, es kommen diverse fehlermeldungen.....
vlt hat jemand ne idee, ich verzweifel langsam
Java:
public class Maddieren {
static double[][] add(double[][] a, double[][]b){
double[][] result = new double[a.length][a[0].length];
for(int i = 0; i < a.length; i++){
for(int j = 0; j < a[0].length; j++){
c[i][j] = (a[i][j] + b[i][j]);
}
}
return c;
}
public static void main (String [] args) {
double[][]a = (Math.random());
double[][]b = (Math.random());
double[][]c = new int[12];
System.out.println();
System.out.println("Matrix A:");
System.out.println (a);
System.out.println();
System.out.println("Matrix B:");
System.out.println (a);
System.out.println();
System.out.println("Summe S=A+B:");
System.out.println (c);
}
}