alguien que me ayude a reparar este código con errores por favor
Publicado por rafael (18 intervenciones) el 09/10/2019 01:10:11
el codigo consta de 2 matrices de n*n (elegimos de cuanto las filas y las columnas ) y luego las dos matrices hay que sumarlas,restarlas y multiplicarlas
me salen vario errores y como soy super novato en java no interpreto porque es el error
ayuda porfavor
me salen vario errores y como soy super novato en java no interpreto porque es el error
ayuda porfavor
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import javax.swing.*;
import java.lang.*;
import java.util.Random;
public class cositas
{
public static void main(String args[])
{
int filas =Integer.parseInt(JOptionPane.showInputDialog("Digite las filas de la matriz bien sexys "));
int columnas=Integer.parseInt(JOptionPane.showInputDialog("Digite las columnas de la matriz"));
int matriza[][]=new int [filas][columnas];
int matrizb[][]=new int [filas][columnas];
int matrizc[][]=new int [filas][columnas];
}
//--------------------------
//llenar matriza
public static void llenar1(int matriza[][])
{
int j,k;
JOptionPane.showInputDialog(null,"datos de la matriz 1");
for(j=0;j<matriza.length;j++){
for(k=0;k<matriza.length;k++){
matriza[j][k]=Integer.parseInt(JOptionPane.showInputDialog("escribe un numero:a["+j+"]["+k+"]"+" de la matriz 1"));
JOptionPane.showMessageDialog(null,matriza[j][k]+"");
}
}
}
//---------------------------
//llenar matrizb
public static void llenar2(int matrizb[][])
{
int j,k;
JOptionPane.showInputDialog(null,"datos de la matriz 1");
for(j=0;j<matrizb.length;j++){
for(k=0;k<matrizb.length;k++){
matrizb[j][k]=Integer.parseInt(JOptionPane.showInputDialog("escribe un numero:a["+j+"]["+k+"]"+" de la matriz 1"));
JOptionPane.showMessageDialog(null,matrizb[j][k]+"");
}
}
}
//-------------------------------------------------
public static void sumar(int matriza[][] , int matrizb[][] )
{
JOptionPane.showInputDialog(null,"suma de las matrices");
//matrizc = new int[filas][columnas];
for(int i=0; i<matrizc; i++){
for(int j=0; j< matrizc; j++){
matrizc[i][j] = matriza[i][j] + matrizb[i][j];
}
}
}
//--------------------------------------------------------------
public static void restar(int matriza[][] , int matrizb[][] )
{
JOptionPane.showInputDialog(null,"resta de las matrices");
//matrizc = new int[filas][columnas];
for(int i=0; i<matrizc; i++){
for(int j=0; j<matrizc; j++){
matrizc[i][j] = matriza[i][j] - matrizb[i][j];
}
}
}
//--------------------------------------------------------------
//multiplicar matriz
public static void multiplicar(int matriza[][] , int matrizb[][] ) {
for (int i = 0; i <matriza.length; i++) {
for (int j = 0; j <matrizb[0].length; j++) {
for (int k = 0; k <matriza[0].length; k++) {
matrizc[i][j]= matriza[i][k] * matrizb[k][j];
}
}
}
}
}
Valora esta pregunta
0