Sei sulla pagina 1di 16

ARREGLO BIDIMENSIONALES – ARREGLOS

MULTIDIMENSIONALES
PROF. JOSE ARMANDO TIZNADO UBILLUS

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 1


ARREGLO BIDIMENSIONALES - MULTIDIMENSIONALES
• Son estructuras de tamaño fijo organizadas por filas y columnas.
• Estas estructuras almacenan valores del mismo tipo de dato.
• Cada posición se identifica por la fila y la columna
• Por lo general, estas estructuras se conocen con el nombre de matrices.
La partición de los arreglos llegaría
Ejemplo: físicamente hasta 3 filas y 5 columnas

TipoVariable[ ][ ] array=new TipoVariable[3][5]

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 2


¿CÓMO SE DEFINE UN ARREGLO BIDIMENSIONAL EN JAVA?

 Si se va a definir un arreglo bidimensional de tipo  Si se va a definir un arreglo bidimensional de tipo


entero de 3filas y 5 columnas, llamado matriz, real de 2 filas y 2 columnas llamado matriz, sería
sería así: así:
 int matriz[ ][ ]=new int [3][5];  double matriz[ ][ ]=new double [2][2];

TipoVariable[ ][ ] array=new TipoVariable[3][5]

Filas Columnas

Primero va el número de
PROF. JOSE ARMANDO TIZNADO UBILLUS
filas y luego el número de 03/10/2017 3

columnas
¿CÓMO SE GUARDAN LOS ELEMENTOS EN UN ARREGLO
BIDIMENSIONAL?

 Se utiliza el nombre de la matriz, seguido de paréntesis cuadrado con el número


de la fila y posteriormente otro paréntesis cuadrado con el número de la
columna

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 4


¿CÓMO SE ACCEDE A LOS DATOS ALMACENADOS EN UN
ARREGLO BIDIMENSIONAL?

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 5


¿OBTENER Y GENERAR UNA SUMATORIA DE UN ARREGLO
BIDIMENSIONAL?

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 6


¿CÓMO SE RECORREN LOS ARREGLOS BIDIMENSIONALES CON
CICLOS REPETITIVOS?

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 7


RECORRIENDO PRIMERO FILAS Y DESPUÉS COLUMNAS

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 8


RECORRIENDO PRIMERO FILAS Y DESPUÉS COLUMNAS

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 9


CREACIÓN DE CLASE

1. Crear un proyecto Nuevo.


2. Hacer clic derecho el package -> Nuevo -> Java Class.
3. Luego escribir el nombre de la clase.
4. Clic en el botón Finalizar
5. Deberás crear los siguiente package tal como se muestra
en la imagen

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 10


CREANDO LA CLASE CDATOS AL JTABLE

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 11


FORMULARIO

BtnProcesar

DataGrid

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 12


CÓDIGO DEL FORMULARIO

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 13


EJERCICIO PRACTICO
ESTE EJERCICIO REFORZARA NUESTRO CONOCIMIENTO BASADO EN LA PRACTICA QUE EJECUTAMOS
EN EL ANTERIOR EJERCICIO.

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 14


PRACTICA 1

 Realizar el siguiente ejercicio


generando la sumatoria por filas,
ingresando sus valores de cada celda
ingresada.

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 15


PRACTICA 2

 Generar los siguientes resultado del


ejercicios usando el matrices para el
resultado de este ejercicio que esta
basado en el incremento de numero
ascendente.

PROF. JOSE ARMANDO TIZNADO UBILLUS 03/10/2017 16

Potrebbero piacerti anche