-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInput_Output_ComplexMatrix.java
More file actions
69 lines (68 loc) · 3.44 KB
/
Copy pathInput_Output_ComplexMatrix.java
File metadata and controls
69 lines (68 loc) · 3.44 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.util.Scanner;
public class Input_Output_ComplexMatrix {
public void buttonChoice(int button) throws Matrix.MatrixExpection {
Scanner scanner = new Scanner(System.in);
if (button == 5){
System.out.println("Enter number of rows and columns of your matrix.");
int rows = scanner.nextInt();
int cols = scanner.nextInt();
Matrix newMatrix = new Matrix(rows, cols);
System.out.println("Enter elements of your matrix. Each on a separate line.");
newMatrix.CreateMatrix(rows, cols);
System.out.println("It's your matrix.");
newMatrix.showMatrix();
}
else if (button == 6){
System.out.println("Enter number of rows and columns of your first matrix.");
int rows = scanner.nextInt();
int cols = scanner.nextInt();
Matrix first = new Matrix(rows, cols);
System.out.println("Enter elements of your matrix. Each on a separate line.");
first.CreateMatrix(rows, cols);
System.out.println("It's your first matrix.");
first.showMatrix();
System.out.println("Enter number of rows and columns of your second matrix.");
rows = scanner.nextInt();
cols = scanner.nextInt();
Matrix second = new Matrix(rows, cols);
System.out.println("Enter elements of your matrix. Each on a separate line.");
second.CreateMatrix(rows, cols);
System.out.println("It's your second matrix.");
second.showMatrix();
System.out.println("It's the summary matrix of your two matrices.");
first.addMatrices(second).showMatrix();
}
else if (button == 7){
System.out.println("Enter number of rows and columns of your first matrix.");
int rows = scanner.nextInt();
int cols = scanner.nextInt();
Matrix first = new Matrix(rows, cols);
System.out.println("Enter elements of your matrix. Each on a separate line.");
first.CreateMatrix(rows, cols);
System.out.println("It's your first matrix.");
first.showMatrix();
System.out.println("Enter number of rows and columns of your second matrix.");
rows = scanner.nextInt();
cols = scanner.nextInt();
Matrix second = new Matrix(rows, cols);
System.out.println("Enter elements of your matrix. Each on a separate line.");
second.CreateMatrix(rows, cols);
System.out.println("It's your second matrix");
second.showMatrix();
System.out.println("It's the summary matrix of your two matrices.");
first.multiplyMatrices(second).showMatrix();
}
else if (button == 8){
System.out.println("Enter number of rows and columns of your matrix.");
int rows = scanner.nextInt();
int cols = scanner.nextInt();
Matrix newMatrix = new Matrix(rows, cols);
System.out.println("Enter elements of your matrix. Each on a separate line.");
newMatrix.CreateMatrix(rows, cols);
System.out.println("It's your original matrix.");
newMatrix.showMatrix();
System.out.println("It's your transpose matrix.");
newMatrix.transpose().showMatrix();
}
}
}