SlideShare una empresa de Scribd logo
1 de 20
Faculty: Systems engineer
Course: Introduction of Programming
Topic: Arreglos multidimensionales en JAVA
________________________________________________
Socializer: Luis Fernando Castellanos Guarín
Email: Luis.castellanosg@usantoto.edu.co
Phone: 321-4582098
Topics
Arreglos
• About / Acerca de
• Como funciona /How it works
• Sintaxis / Syntax
• Ejemplos / examples
• Como recorrer un array multidimensional
• Ejercicios / Exercises
Arreglos Multidimensionales
Un array multidimensional son más de un array unidimensional unidos, para que te
hagas una idea, es como si fuera una tabla. Se crea igual que un array unidimensional,
solo hay que añadir un corchete mas con un tamaño en la definición del array
Syntax & Example
La sintaxis para declarar e inicializar un array multidimensional será:
También podemos alternativamente usar esta declaración:
• byte[][] edad = new byte[4][3];
• short [][] edad = new short[4][3];
• int[][] edad = new int[4][3];
• long[][] edad = new long[4][3];
• float[][] estatura = new float[3][2];
• double[][] estatura = new double[3][2];
• boolean[][] estado = new boolean[5][4];
• char[][] sexo = new char[2][1];
• String[][] nombre = new String[2][1];
Ejemplo:
Tipo_de_variable[ ][ ]… [ ] Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN];
Tipo_de_variable[ ][ ] … [ ] Nombre_del_array;
Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN];
Como recorrer un array multidimensional?
La sintaxis para declarar e inicializar un array multidimensional será:
También podemos alternativamente usar esta declaración:
• byte[][] edad = new byte[4][3];
• short [][] edad = new short[4][3];
• int[][] edad = new int[4][3];
• long[][] edad = new long[4][3];
• float[][] estatura = new float[3][2];
• double[][] estatura = new double[3][2];
• boolean[][] estado = new boolean[5][4];
• char[][] sexo = new char[2][1];
• String[][] nombre = new String[2][1];
Ejemplo:
Tipo_de_variable[ ][ ]… [ ] Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN];
Tipo_de_variable[ ][ ] … [ ] Nombre_del_array;
Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN];
How it works
//Array de 5 elementos
int[ ] variable1 = {3, 8, 2, 1,6};
Esta matriz representa un arreglo bidimensional de 3 filas por 5 columnas
cuyos valores son de tipo int.
La manera de declarar este arreglo sería:
int array [3][5];
//Definimos un array de 3 filas x 5 columnas
array[][]={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}};
How it works
To practice!
P2Txx: Estudents_grades
create a JAVA software that:
Store in a matrix the number of students (10) with which a subject has, with their respective four notes
(P1: 20%, P2:25%, P3:25%, P4:30%.... Notes are random values between 0.0 and 5.0):
We will have 20 rows representing each student and 4 columns in which the respective notes will
appear 0 x P1, 1 x P2, 2 x P3 and 3 x P4). It is requested to make the statement of the matrix and
assign sample values to each item.
Construir un programa en JAVA que,
Almacene en una matriz el número de alumnos (10) con el que cuenta una asignatura, con sus respectivas cuatro
notas (P1: 20%, P2:25%, P3:25%, P4:30%....Las notas son valores aleatorios entre 0.0 y 5.0):
Tendremos 20 filas que representarán a cada estudiante y 4 columnas en las que figurarán las respectivas notas 0 =
P1, 1 = P2, 2 = P3 y 3 = P4). Se pide realizar la declaración de la matriz y
asignarle unos valores de ejemplo a cada elemento.
P2Txx: Estudents_grades
2 2.5 3 4.3
4 3.7 3.2 3.8
4.9 4.3 3.6 4.1
2.3 3.7 4.4 4
3.1 3.6 3.9 4
5 4.8 4.6 4.7
3.2 3 2.9 4
2 2.3 2.1 3.6
4 3.1 3.6 3
3 3.9 4.1 4.7
Notas del semestre (4)
Estudiantes(10)
Double [][] Notas = new double [10][4];
Notas [0][0] = 2;
Notas [0][1] = 2.5;
Notas [0][2] = 3 ;
Notas [0][3] = 4.3;
Notas [1][0] = 4 ;
Notas [1][1] = 3.7 ;
Notas [1][2] = 3.2
Notas [1][3] = 3.8;
Notas [2][0] = 4.9;
Notas [2][1] = 4.3;
Notas [2][2] = 3.6;
Notas [2][3] = 4.1;
…..
P2Txx: Estudents_grades
La mejor forma de recorrer el arreglo multidimensional es usando los ciclos FOR:
//Recorremos la primera columna de todas las filas
for(int i=0;i<array.length;i++){
System.out.println(array[i][0]);
}
//Recorremos todas las columnas de la segunda fila
for(int i=0;i<array[0].length;i++){
System.out.println(array[1][i]);
}
//Recorremos el array multidimensional
for (int i=0;i<array.length;i++){
for(int j=0;j<array[0].length;j++){
System.out.println(array[i][j]);
}
}
P2Txx: swimming_competition
create a JAVA software that:
Allow to simulate the data of a swimming competition where the four times are stored for each competitor and
also determine based on all the times of the competitors who is the winner. The user must specify how many times
(competitors) he wants to enter and the times must be generated randomly between 6.0 and 10 sec per lap.
Additionally, you must view all the times of each competitor.
Construir un programa en JAVA que,
Permita simular los datos de una competencia de natación donde se almacenan los cuatro tiempos por cada
competidor y además determinar con base en todos los tiempos de los competidores cual es el ganador. El usuario
debe especificar cuantos tiempos (competidores) desea ingresar y los tiempos se deben generar de forma aleatoria
entre 6.0 sec hasta 10 sec por vuelta.
Adicionalmente debe visualizar todos los tiempos de cada competidor.
P2Txx: rating_the_food
create a JAVA software that:
Let USTA learn how students rate food in the Giordano Bruno building cafeteria. For this, a scale of 1 to 10 was defined (1 denotes horrible and 10
denotes excellent). The software will perform a simulation where you randomly generate these grades for a month (20 days) for a number of
students (the user will determine how many students will be surveyed).
With these ratings the software will determine how much was the percentage of those who rated the food as:
• bad (<= 3)
• Regular (between 4 and 6)
• Excellent (> = 7
Construir un programa en JAVA que,
Permita a la USTA conocer cómo califican los estudiantes la comida de la cafetería del edificio Giordano Bruno. Para ello definió una escala de 1 a 10
(1 denota horrible y 10 denota excelente). El software realizara una simulación donde genere de forma aleatoria dichas calificaciones durante un
mes (20 días) para un número de estudiantes (el usuario determinara a cuántos estudiantes se encuestarán).
Con dichas calificaciones el software determinara cuanto fue el porcentaje de los que calificaron la comida como:
• mala (<=3)
• Regular (entre 4 y 6)
• Excelente (>=7
P2Txx: convert_words
Create a JAVA software that:
Allow to create a 4x5 matrix with the following information:
• maria, pedro, JOSE, camilo, rodrigo
• Ana, Lucia, Martha, Juliana, Patricia
• Felipe, ALEXANDER, soffy, Carmen, Augusto
• Alfredo, Luis, Ramiro, Karen, ANDREA
With the previous information, replace all the vowels with = a = @, e = 3, i = 1, o = Ø (alt + 157), u = ⌂ (alt +127)
Convert all words to uppercase.
Construir un programa en JAVA que,
Permita crear una matriz de 4x5 con la siguiente información:
• maria , pedro, JOSE, camilo, rodrigo
• Ana, lucia, martha, juliana, patricia
• Felipe, ALEXANDER, soffy, Carmen, Augusto
• Alfredo, Luis, Ramiro, Karen, ANDREA
Con la información anterior reemplazar todas las vocales por =a=@, e=3, i=1, o=Ø (alt+157) , u=⌂ (alt +127)
Pasar todas las palabras a mayúsculas.
P2Txx: numbers_of_rows
Create a JAVA software that:
Fill a two-dimensional array of N x M (values that the user must enter by keyboard), with random numbers between 1 and 1000.
Then the software will ask the user to enter a value between 1 to N (number of rows) and the software will display the sum, average, largest and
smallest of the numbers that are in that row.
When the user enters a value equal to zero (0) it must be finished.
Construir un programa en JAVA que,
Llene un array bidimensional de N x M (valores que debe ingresar por teclado el usuario), con números aleatorios
entre 1 y 1000.
Luego el software pedirá al usuario que ingrese un valor entre 1 a N (número de filas) y el software mostrara la suma, el promedio,
el mayor y el menor de los números que están en esa fila.
Cuando el usuario ingrese un valor igual a cero(0) se debe finalizar.
P2Txx: vote_for_clubs_and_bars
Create a JAVA software that:
Performs a simulation to vote on a bill in a department that proposes to end nightclubs and bars:
There are 123 municipalities and each municipality will vote for 0-NO, 1-YES (the votes will be random numbers between 0 and 5000).
Then the software must visualize which was the result of the vote: showing the winner and the loser with their percentage.
Additionally, you must view the rows that have the most voted for the winner and those that least vote for the loser.
Construir un programa en JAVA que,
Realice una simulación para votar un proyecto de ley en un departamento que propone acabar con las discotecas y bares:
Son 123 municipios y cada municipio votara por el 0-NO , 1-SI (los votos serán números randomicos entre 0 y 5000).
Luego el software deberá visualizar cual fue resultado de la votación: mostrando el ganador y el perdedor con su porcentaje.
Adicional deberá visualizar las filas que tienen más votaron por el ganador y las que menos votaron por el perdedor.
P2Txx: Estudents_grades
create a JAVA software that:
Perform the simulation of a voting process for the Boyacá governorate where there are seven (7) candidates from the main
political parties in Colombia:
0-liberal, 1-Conservador, 2- Alianza verde, 3- La U, 4- cambio radical, 5-Centro democrático, 6-MIRA, 7-Polo.
Generation of the vote for the 123 municipalities: bearing in mind that the votes must be between 1 and 1000 but cannot be
repeated.
In turn, get the total votes per party and determine who is the winner and who is second.
Construir un programa en JAVA que,
Realice la simulación de un proceso de votación para la gobernación de Boyacá en donde estén siete (7) candidatos de los
principales partidos políticos de Colombia:
0-liberal, 1-Conservador, 2- Alianza verde, 3- La U, 4- cambio radical, 5-Centro democrático, 6-MIRA, 7-Polo.
Genera la votación para los 123 municipios: teniendo presente que los votos deben estar entre 1 y 1000 pero no se pueden
repetir.
A su vez obtener el total de los votos por partido y determinar quien es el ganador y quien es el segundo.
JAVA arreglos multidimensionales
JAVA arreglos multidimensionales

Más contenido relacionado

La actualidad más candente

Computación 1 curso tecmilenio
Computación 1  curso tecmilenioComputación 1  curso tecmilenio
Computación 1 curso tecmilenioMaestros Online
 
Machine learning: aprendizaje basado en árboles de decisión
Machine learning: aprendizaje basado en árboles de decisiónMachine learning: aprendizaje basado en árboles de decisión
Machine learning: aprendizaje basado en árboles de decisiónAngel Vázquez Patiño
 
Lo básico para programar
Lo básico para programarLo básico para programar
Lo básico para programarCelestino Duran
 
Ejercicios grupales programacion
Ejercicios grupales programacionEjercicios grupales programacion
Ejercicios grupales programacionmikeburhnan
 
Computación 2 sept 2012
Computación 2 sept 2012Computación 2 sept 2012
Computación 2 sept 2012Maestros Online
 
Ejercicios De ProgramacióN Felipe
Ejercicios De ProgramacióN FelipeEjercicios De ProgramacióN Felipe
Ejercicios De ProgramacióN Felipefelipe cespdes
 
Guía 7 matemática 7
Guía 7 matemática 7Guía 7 matemática 7
Guía 7 matemática 7Karlos Rivero
 
Lo básico para programar
Lo básico para programarLo básico para programar
Lo básico para programarCelestino Duran
 

La actualidad más candente (11)

Computación 1 curso tecmilenio
Computación 1  curso tecmilenioComputación 1  curso tecmilenio
Computación 1 curso tecmilenio
 
Listado Ejercicios Básicos Java 3
Listado Ejercicios Básicos Java 3Listado Ejercicios Básicos Java 3
Listado Ejercicios Básicos Java 3
 
Listado Ejercicios Básicos Java 2
Listado Ejercicios Básicos Java 2Listado Ejercicios Básicos Java 2
Listado Ejercicios Básicos Java 2
 
Machine learning: aprendizaje basado en árboles de decisión
Machine learning: aprendizaje basado en árboles de decisiónMachine learning: aprendizaje basado en árboles de decisión
Machine learning: aprendizaje basado en árboles de decisión
 
Ejercicios java
Ejercicios javaEjercicios java
Ejercicios java
 
Lo básico para programar
Lo básico para programarLo básico para programar
Lo básico para programar
 
Ejercicios grupales programacion
Ejercicios grupales programacionEjercicios grupales programacion
Ejercicios grupales programacion
 
Computación 2 sept 2012
Computación 2 sept 2012Computación 2 sept 2012
Computación 2 sept 2012
 
Ejercicios De ProgramacióN Felipe
Ejercicios De ProgramacióN FelipeEjercicios De ProgramacióN Felipe
Ejercicios De ProgramacióN Felipe
 
Guía 7 matemática 7
Guía 7 matemática 7Guía 7 matemática 7
Guía 7 matemática 7
 
Lo básico para programar
Lo básico para programarLo básico para programar
Lo básico para programar
 

Similar a JAVA arreglos multidimensionales

JAVA arreglos unidimensionales y ciclos (FOR / WHILE)
JAVA arreglos unidimensionales y ciclos (FOR / WHILE)JAVA arreglos unidimensionales y ciclos (FOR / WHILE)
JAVA arreglos unidimensionales y ciclos (FOR / WHILE)Universidad Santo Tomás
 
Lab 3 while for compiladores e interpretes
Lab 3 while for  compiladores e interpretesLab 3 while for  compiladores e interpretes
Lab 3 while for compiladores e interpretes1325210317
 
Propuestos python
Propuestos pythonPropuestos python
Propuestos pythonDanielVA3
 
Fundamentos de Programación - Unidad IV: Arreglos (Vectores)
Fundamentos de Programación - Unidad IV: Arreglos (Vectores)Fundamentos de Programación - Unidad IV: Arreglos (Vectores)
Fundamentos de Programación - Unidad IV: Arreglos (Vectores)José Antonio Sandoval Acosta
 
Curso Compiladores e Interpretes
Curso Compiladores e InterpretesCurso Compiladores e Interpretes
Curso Compiladores e InterpretesWendy Misari
 
Introducción a JavaScript 1
Introducción a JavaScript 1Introducción a JavaScript 1
Introducción a JavaScript 1Lorenzo Alejo
 
Compiladores e-interprete
Compiladores e-interprete Compiladores e-interprete
Compiladores e-interprete Juan Carlos EV
 
Fundamentos de Programacion - Unidad 5 arreglos (vectores)
Fundamentos de Programacion - Unidad 5 arreglos (vectores)Fundamentos de Programacion - Unidad 5 arreglos (vectores)
Fundamentos de Programacion - Unidad 5 arreglos (vectores)José Antonio Sandoval Acosta
 
VectoresMatricesI.ppt
VectoresMatricesI.pptVectoresMatricesI.ppt
VectoresMatricesI.pptjonhMCH
 
VectoresMatricesI.ppt
VectoresMatricesI.pptVectoresMatricesI.ppt
VectoresMatricesI.pptjonhMCH
 
tecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdftecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdfLauraPrieto83
 
tecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdftecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdfMajuMuoz
 
tecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdftecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdfssuser7ec9f9
 

Similar a JAVA arreglos multidimensionales (20)

JAVA arreglos
JAVA arreglosJAVA arreglos
JAVA arreglos
 
JAVA arreglos unidimensionales y ciclos (FOR / WHILE)
JAVA arreglos unidimensionales y ciclos (FOR / WHILE)JAVA arreglos unidimensionales y ciclos (FOR / WHILE)
JAVA arreglos unidimensionales y ciclos (FOR / WHILE)
 
Lab 3 while for compiladores e interpretes
Lab 3 while for  compiladores e interpretesLab 3 while for  compiladores e interpretes
Lab 3 while for compiladores e interpretes
 
Propuestos python
Propuestos pythonPropuestos python
Propuestos python
 
Fundamentos de Programación - Unidad IV: Arreglos (Vectores)
Fundamentos de Programación - Unidad IV: Arreglos (Vectores)Fundamentos de Programación - Unidad IV: Arreglos (Vectores)
Fundamentos de Programación - Unidad IV: Arreglos (Vectores)
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Curso Compiladores e Interpretes
Curso Compiladores e InterpretesCurso Compiladores e Interpretes
Curso Compiladores e Interpretes
 
Labo for while
Labo for whileLabo for while
Labo for while
 
Ejercicios de python
Ejercicios de pythonEjercicios de python
Ejercicios de python
 
Introducción a JavaScript 1
Introducción a JavaScript 1Introducción a JavaScript 1
Introducción a JavaScript 1
 
Compiladores e-interprete
Compiladores e-interprete Compiladores e-interprete
Compiladores e-interprete
 
Fundamentos de Programacion - Unidad 5 arreglos (vectores)
Fundamentos de Programacion - Unidad 5 arreglos (vectores)Fundamentos de Programacion - Unidad 5 arreglos (vectores)
Fundamentos de Programacion - Unidad 5 arreglos (vectores)
 
Estructura de Datos: Arreglos
Estructura de Datos: Arreglos Estructura de Datos: Arreglos
Estructura de Datos: Arreglos
 
Programación 1: estructuras de datos
Programación 1: estructuras de datosProgramación 1: estructuras de datos
Programación 1: estructuras de datos
 
VectoresMatricesI.ppt
VectoresMatricesI.pptVectoresMatricesI.ppt
VectoresMatricesI.ppt
 
VectoresMatricesI.ppt
VectoresMatricesI.pptVectoresMatricesI.ppt
VectoresMatricesI.ppt
 
Taller - Primeros ejercicios de programación
Taller - Primeros ejercicios de programaciónTaller - Primeros ejercicios de programación
Taller - Primeros ejercicios de programación
 
tecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdftecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdf
 
tecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdftecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdf
 
tecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdftecnologia trabajo en equipo.pdf
tecnologia trabajo en equipo.pdf
 

Último

TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOSTEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOSjlorentemartos
 
MAYO 1 PROYECTO día de la madre el amor más grande
MAYO 1 PROYECTO día de la madre el amor más grandeMAYO 1 PROYECTO día de la madre el amor más grande
MAYO 1 PROYECTO día de la madre el amor más grandeMarjorie Burga
 
Informatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos BásicosInformatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos BásicosCesarFernandez937857
 
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdfEjercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdfMaritzaRetamozoVera
 
Heinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoHeinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoFundación YOD YOD
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.amayarogel
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAEl Fortí
 
Lecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdadLecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdadAlejandrino Halire Ccahuana
 
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...JAVIER SOLIS NOYOLA
 
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptxSEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptxYadi Campos
 
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIARAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIACarlos Campaña Montenegro
 
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxzulyvero07
 
Registro Auxiliar - Primaria 2024 (1).pptx
Registro Auxiliar - Primaria  2024 (1).pptxRegistro Auxiliar - Primaria  2024 (1).pptx
Registro Auxiliar - Primaria 2024 (1).pptxFelicitasAsuncionDia
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
TECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptx
TECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptxTECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptx
TECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptxKarlaMassielMartinez
 
Identificación de componentes Hardware del PC
Identificación de componentes Hardware del PCIdentificación de componentes Hardware del PC
Identificación de componentes Hardware del PCCesarFernandez937857
 

Último (20)

TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOSTEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
 
MAYO 1 PROYECTO día de la madre el amor más grande
MAYO 1 PROYECTO día de la madre el amor más grandeMAYO 1 PROYECTO día de la madre el amor más grande
MAYO 1 PROYECTO día de la madre el amor más grande
 
Sesión de clase: Defendamos la verdad.pdf
Sesión de clase: Defendamos la verdad.pdfSesión de clase: Defendamos la verdad.pdf
Sesión de clase: Defendamos la verdad.pdf
 
Informatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos BásicosInformatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos Básicos
 
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdfEjercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
 
Heinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoHeinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativo
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.
 
Unidad 3 | Metodología de la Investigación
Unidad 3 | Metodología de la InvestigaciónUnidad 3 | Metodología de la Investigación
Unidad 3 | Metodología de la Investigación
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
 
Medición del Movimiento Online 2024.pptx
Medición del Movimiento Online 2024.pptxMedición del Movimiento Online 2024.pptx
Medición del Movimiento Online 2024.pptx
 
Lecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdadLecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdad
 
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
 
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptxSEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
 
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIARAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
 
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
 
Registro Auxiliar - Primaria 2024 (1).pptx
Registro Auxiliar - Primaria  2024 (1).pptxRegistro Auxiliar - Primaria  2024 (1).pptx
Registro Auxiliar - Primaria 2024 (1).pptx
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
 
Tema 8.- PROTECCION DE LOS SISTEMAS DE INFORMACIÓN.pdf
Tema 8.- PROTECCION DE LOS SISTEMAS DE INFORMACIÓN.pdfTema 8.- PROTECCION DE LOS SISTEMAS DE INFORMACIÓN.pdf
Tema 8.- PROTECCION DE LOS SISTEMAS DE INFORMACIÓN.pdf
 
TECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptx
TECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptxTECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptx
TECNOLOGÍA FARMACEUTICA OPERACIONES UNITARIAS.pptx
 
Identificación de componentes Hardware del PC
Identificación de componentes Hardware del PCIdentificación de componentes Hardware del PC
Identificación de componentes Hardware del PC
 

JAVA arreglos multidimensionales

  • 1.
  • 2. Faculty: Systems engineer Course: Introduction of Programming Topic: Arreglos multidimensionales en JAVA ________________________________________________ Socializer: Luis Fernando Castellanos Guarín Email: Luis.castellanosg@usantoto.edu.co Phone: 321-4582098
  • 3. Topics Arreglos • About / Acerca de • Como funciona /How it works • Sintaxis / Syntax • Ejemplos / examples • Como recorrer un array multidimensional • Ejercicios / Exercises
  • 4. Arreglos Multidimensionales Un array multidimensional son más de un array unidimensional unidos, para que te hagas una idea, es como si fuera una tabla. Se crea igual que un array unidimensional, solo hay que añadir un corchete mas con un tamaño en la definición del array
  • 5. Syntax & Example La sintaxis para declarar e inicializar un array multidimensional será: También podemos alternativamente usar esta declaración: • byte[][] edad = new byte[4][3]; • short [][] edad = new short[4][3]; • int[][] edad = new int[4][3]; • long[][] edad = new long[4][3]; • float[][] estatura = new float[3][2]; • double[][] estatura = new double[3][2]; • boolean[][] estado = new boolean[5][4]; • char[][] sexo = new char[2][1]; • String[][] nombre = new String[2][1]; Ejemplo: Tipo_de_variable[ ][ ]… [ ] Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN]; Tipo_de_variable[ ][ ] … [ ] Nombre_del_array; Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN];
  • 6. Como recorrer un array multidimensional? La sintaxis para declarar e inicializar un array multidimensional será: También podemos alternativamente usar esta declaración: • byte[][] edad = new byte[4][3]; • short [][] edad = new short[4][3]; • int[][] edad = new int[4][3]; • long[][] edad = new long[4][3]; • float[][] estatura = new float[3][2]; • double[][] estatura = new double[3][2]; • boolean[][] estado = new boolean[5][4]; • char[][] sexo = new char[2][1]; • String[][] nombre = new String[2][1]; Ejemplo: Tipo_de_variable[ ][ ]… [ ] Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN]; Tipo_de_variable[ ][ ] … [ ] Nombre_del_array; Nombre_del_array = new Tipo_de_variable[dimensión1][dimensión2]…[dimensiónN];
  • 7. How it works //Array de 5 elementos int[ ] variable1 = {3, 8, 2, 1,6}; Esta matriz representa un arreglo bidimensional de 3 filas por 5 columnas cuyos valores son de tipo int. La manera de declarar este arreglo sería: int array [3][5]; //Definimos un array de 3 filas x 5 columnas array[][]={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}};
  • 10. P2Txx: Estudents_grades create a JAVA software that: Store in a matrix the number of students (10) with which a subject has, with their respective four notes (P1: 20%, P2:25%, P3:25%, P4:30%.... Notes are random values between 0.0 and 5.0): We will have 20 rows representing each student and 4 columns in which the respective notes will appear 0 x P1, 1 x P2, 2 x P3 and 3 x P4). It is requested to make the statement of the matrix and assign sample values to each item. Construir un programa en JAVA que, Almacene en una matriz el número de alumnos (10) con el que cuenta una asignatura, con sus respectivas cuatro notas (P1: 20%, P2:25%, P3:25%, P4:30%....Las notas son valores aleatorios entre 0.0 y 5.0): Tendremos 20 filas que representarán a cada estudiante y 4 columnas en las que figurarán las respectivas notas 0 = P1, 1 = P2, 2 = P3 y 3 = P4). Se pide realizar la declaración de la matriz y asignarle unos valores de ejemplo a cada elemento.
  • 11. P2Txx: Estudents_grades 2 2.5 3 4.3 4 3.7 3.2 3.8 4.9 4.3 3.6 4.1 2.3 3.7 4.4 4 3.1 3.6 3.9 4 5 4.8 4.6 4.7 3.2 3 2.9 4 2 2.3 2.1 3.6 4 3.1 3.6 3 3 3.9 4.1 4.7 Notas del semestre (4) Estudiantes(10) Double [][] Notas = new double [10][4]; Notas [0][0] = 2; Notas [0][1] = 2.5; Notas [0][2] = 3 ; Notas [0][3] = 4.3; Notas [1][0] = 4 ; Notas [1][1] = 3.7 ; Notas [1][2] = 3.2 Notas [1][3] = 3.8; Notas [2][0] = 4.9; Notas [2][1] = 4.3; Notas [2][2] = 3.6; Notas [2][3] = 4.1; …..
  • 12. P2Txx: Estudents_grades La mejor forma de recorrer el arreglo multidimensional es usando los ciclos FOR: //Recorremos la primera columna de todas las filas for(int i=0;i<array.length;i++){ System.out.println(array[i][0]); } //Recorremos todas las columnas de la segunda fila for(int i=0;i<array[0].length;i++){ System.out.println(array[1][i]); } //Recorremos el array multidimensional for (int i=0;i<array.length;i++){ for(int j=0;j<array[0].length;j++){ System.out.println(array[i][j]); } }
  • 13. P2Txx: swimming_competition create a JAVA software that: Allow to simulate the data of a swimming competition where the four times are stored for each competitor and also determine based on all the times of the competitors who is the winner. The user must specify how many times (competitors) he wants to enter and the times must be generated randomly between 6.0 and 10 sec per lap. Additionally, you must view all the times of each competitor. Construir un programa en JAVA que, Permita simular los datos de una competencia de natación donde se almacenan los cuatro tiempos por cada competidor y además determinar con base en todos los tiempos de los competidores cual es el ganador. El usuario debe especificar cuantos tiempos (competidores) desea ingresar y los tiempos se deben generar de forma aleatoria entre 6.0 sec hasta 10 sec por vuelta. Adicionalmente debe visualizar todos los tiempos de cada competidor.
  • 14. P2Txx: rating_the_food create a JAVA software that: Let USTA learn how students rate food in the Giordano Bruno building cafeteria. For this, a scale of 1 to 10 was defined (1 denotes horrible and 10 denotes excellent). The software will perform a simulation where you randomly generate these grades for a month (20 days) for a number of students (the user will determine how many students will be surveyed). With these ratings the software will determine how much was the percentage of those who rated the food as: • bad (<= 3) • Regular (between 4 and 6) • Excellent (> = 7 Construir un programa en JAVA que, Permita a la USTA conocer cómo califican los estudiantes la comida de la cafetería del edificio Giordano Bruno. Para ello definió una escala de 1 a 10 (1 denota horrible y 10 denota excelente). El software realizara una simulación donde genere de forma aleatoria dichas calificaciones durante un mes (20 días) para un número de estudiantes (el usuario determinara a cuántos estudiantes se encuestarán). Con dichas calificaciones el software determinara cuanto fue el porcentaje de los que calificaron la comida como: • mala (<=3) • Regular (entre 4 y 6) • Excelente (>=7
  • 15. P2Txx: convert_words Create a JAVA software that: Allow to create a 4x5 matrix with the following information: • maria, pedro, JOSE, camilo, rodrigo • Ana, Lucia, Martha, Juliana, Patricia • Felipe, ALEXANDER, soffy, Carmen, Augusto • Alfredo, Luis, Ramiro, Karen, ANDREA With the previous information, replace all the vowels with = a = @, e = 3, i = 1, o = Ø (alt + 157), u = ⌂ (alt +127) Convert all words to uppercase. Construir un programa en JAVA que, Permita crear una matriz de 4x5 con la siguiente información: • maria , pedro, JOSE, camilo, rodrigo • Ana, lucia, martha, juliana, patricia • Felipe, ALEXANDER, soffy, Carmen, Augusto • Alfredo, Luis, Ramiro, Karen, ANDREA Con la información anterior reemplazar todas las vocales por =a=@, e=3, i=1, o=Ø (alt+157) , u=⌂ (alt +127) Pasar todas las palabras a mayúsculas.
  • 16. P2Txx: numbers_of_rows Create a JAVA software that: Fill a two-dimensional array of N x M (values that the user must enter by keyboard), with random numbers between 1 and 1000. Then the software will ask the user to enter a value between 1 to N (number of rows) and the software will display the sum, average, largest and smallest of the numbers that are in that row. When the user enters a value equal to zero (0) it must be finished. Construir un programa en JAVA que, Llene un array bidimensional de N x M (valores que debe ingresar por teclado el usuario), con números aleatorios entre 1 y 1000. Luego el software pedirá al usuario que ingrese un valor entre 1 a N (número de filas) y el software mostrara la suma, el promedio, el mayor y el menor de los números que están en esa fila. Cuando el usuario ingrese un valor igual a cero(0) se debe finalizar.
  • 17. P2Txx: vote_for_clubs_and_bars Create a JAVA software that: Performs a simulation to vote on a bill in a department that proposes to end nightclubs and bars: There are 123 municipalities and each municipality will vote for 0-NO, 1-YES (the votes will be random numbers between 0 and 5000). Then the software must visualize which was the result of the vote: showing the winner and the loser with their percentage. Additionally, you must view the rows that have the most voted for the winner and those that least vote for the loser. Construir un programa en JAVA que, Realice una simulación para votar un proyecto de ley en un departamento que propone acabar con las discotecas y bares: Son 123 municipios y cada municipio votara por el 0-NO , 1-SI (los votos serán números randomicos entre 0 y 5000). Luego el software deberá visualizar cual fue resultado de la votación: mostrando el ganador y el perdedor con su porcentaje. Adicional deberá visualizar las filas que tienen más votaron por el ganador y las que menos votaron por el perdedor.
  • 18. P2Txx: Estudents_grades create a JAVA software that: Perform the simulation of a voting process for the Boyacá governorate where there are seven (7) candidates from the main political parties in Colombia: 0-liberal, 1-Conservador, 2- Alianza verde, 3- La U, 4- cambio radical, 5-Centro democrático, 6-MIRA, 7-Polo. Generation of the vote for the 123 municipalities: bearing in mind that the votes must be between 1 and 1000 but cannot be repeated. In turn, get the total votes per party and determine who is the winner and who is second. Construir un programa en JAVA que, Realice la simulación de un proceso de votación para la gobernación de Boyacá en donde estén siete (7) candidatos de los principales partidos políticos de Colombia: 0-liberal, 1-Conservador, 2- Alianza verde, 3- La U, 4- cambio radical, 5-Centro democrático, 6-MIRA, 7-Polo. Genera la votación para los 123 municipios: teniendo presente que los votos deben estar entre 1 y 1000 pero no se pueden repetir. A su vez obtener el total de los votos por partido y determinar quien es el ganador y quien es el segundo.