41 lines
957 B
Java
41 lines
957 B
Java
|
package VL06.Aufgabe02;
|
||
|
|
||
|
/**
|
||
|
* Vorlesung 6 / Aufgabe 2
|
||
|
*
|
||
|
* @author Sebastian Brosch
|
||
|
*/
|
||
|
class Aufgabe02 {
|
||
|
public static void main(String[] args) {
|
||
|
Matrix matrix1 = new Matrix(3, 2);
|
||
|
matrix1.setValue(0, 0, 5);
|
||
|
matrix1.setValue(1, 0, 4);
|
||
|
matrix1.setValue(2, 0, 8);
|
||
|
matrix1.setValue(0, 1, 7);
|
||
|
matrix1.setValue(1, 1, 3);
|
||
|
matrix1.setValue(2, 1, 9);
|
||
|
|
||
|
Matrix matrix2 = new Matrix(3, 2);
|
||
|
matrix2.setValue(0, 0, 9);
|
||
|
matrix2.setValue(1, 0, 3);
|
||
|
matrix2.setValue(2, 0, 4);
|
||
|
matrix2.setValue(0, 1, 8);
|
||
|
matrix2.setValue(1, 1, 6);
|
||
|
matrix2.setValue(2, 1, 3);
|
||
|
|
||
|
System.out.println("\nMatrix 1:");
|
||
|
matrix1.print();
|
||
|
|
||
|
System.out.println("\nMatrix 2:");
|
||
|
matrix2.print();
|
||
|
|
||
|
System.out.println("\nMatrix 1 nach Multiplikation mit 5:");
|
||
|
matrix1.multiply(5);
|
||
|
matrix1.print();
|
||
|
|
||
|
System.out.println("\nMatrix 1 nach Addition mit Matrix 2:");
|
||
|
matrix1.add(matrix2);
|
||
|
matrix1.print();
|
||
|
}
|
||
|
}
|