SlideShare una empresa de Scribd logo
Faculty: Systems engineer
Course: Introduction of Programming
Topic: vectores y arreglos
________________________________________________
Socializer: Luis Fernando Castellanos Guarín
Karen Daniela Cuervo Cely
Email: Luis.castellanosg@usantoto.edu.co
Karen.cuervo@usantoto.edu.co
Phone: 3214582098
3105856930
Topics
Arreglos y ciclos
• Presentación / Presentation
• Ejercicios / Exercises
Presentation
Ejercicios en JAVA con para hacer uso de ciclos y arreglos
unidimensionales (Vectores).
A continuación crearemos software con el lenguaje JAVA que resuelva diversas
problemáticas, donde dichas problemáticas las abordaremos usando
ARREGLOS UNIDIMENSIONALES (VECTORES) y CICLOS (FOR /WHILE).
To practice!
P2Txx: vector with its indices
create a JAVA software that:
Automatically create an array of 10 randomly generated number positions between 1 and 100.
Additionally, you can view them on the screen including your index and the value to which it
corresponds.
Note: Use methods (f_menu, f_make_array, f_show_array)
Construir un programa en JAVA que,
Cree automáticamente un arreglo (vector) de 10 posiciones de números generados aleatoriamente
entre 1 y 100. Adicionalmente los visualice en pantalla incluyendo su índice y el valor al que
corresponde.
Nota: Utilice métodos (f_menu, f_crear_arreglo, f_visualizar_arreglo)
P2Txx: Vector_number_multiple_of_five
create a JAVA software that:
Automatically create an array (vector) of N positions with random numbers between 1 and 50.
In addition, display only numbers that are divisible by 5, for the above use methods (f_menu, f_create
array, f_ multiple_five).
Construir un programa en JAVA que,
Cree automáticamente un arreglo (vector) de N posiciones con números randomicos entre 1 y 50.
Adicionalmente que visualice únicamente los números que sean divisibles por 5, para lo anterior use
métodos (f_menu, f_crear_arreglo, f_ver_multiplos_cinco).
P2Txx: Vector with age of N people.
create a JAVA software that:
Generates the age randomly for N people and save them in a vector, with this information:
• determine how many are over 18 and when they are under.
• Those who are over 60 years old.
• Average age.
Construir un programa en JAVA que,
Genere la edad de forma aleatoria para N personas y las guarde en un vector, con esta información:
• determinar cuantos son mayores de 18 años y cuando son menores.
• Cuantos tienen más de 60 años.
• Promedio de edad.
P2Txx: Vector with price of N products
create a JAVA software that:
Automatically generate a vector of 10 random numbers between 1 and 10 (the number cannot be repeated), then
ask the user to enter a number, if the value entered is in the vector you will display a message that says
"Congratulations, you’ve won 1,000,000 pesos", after four failed attempts the software will display a message that
says "Sorry you have lost your chance".
For this exercise, use the while cycle and methods for the processes.
Construir un programa en JAVA que,
Genere automáticamente un vector de 10 números aleatorios entre 1 y 10 (el número no se puede repetir),
después solicite al usuario que ingrese un número, si el valor ingresado esta en el vector le visualizara un mensaje
que diga “Felicitaciones usted ha ganado 1.000.000 de pesos”, si después de cuatro(4) oportunidades no logra
adivinar el software le visualizara un mensaje que diga “Lo siento usted ha perdido su oportunidad”.
Para este ejercicio utilice el ciclo while y métodos para los procesos.
P2Txx: winning_number_machine
create a JAVA software that:
Automatically generate a vector of 10 random numbers between 1 and 10 (the number cannot be repeated), then
ask the user to enter a number, if the value entered is in the vector you will display a message that says
"Congratulations, you’ve won 1,000,000 pesos", after four failed attempts the software will display a message that
says "Sorry you have lost your chance".
For this exercise, use the while cycle and methods for the processes.
Construir un programa en JAVA que,
Genere automáticamente un vector de 10 números aleatorios entre 1 y 10 (el número no se puede repetir),
después solicite al usuario que ingrese un número, si el valor ingresado esta en el vector le visualizara un mensaje
que diga “Felicitaciones usted ha ganado 1.000.000 de pesos”, si después de cuatro(4) oportunidades no logra
adivinar el software le visualizara un mensaje que diga “Lo siento usted ha perdido su oportunidad”.
Para este ejercicio utilice el ciclo while y métodos para los procesos.
P2Txx: words_and_ascii
create a JAVA software that:
Ask the user to enter a word of at least 6 characters by keyboard, the software must convert that word into a string
array, and then display each letter with its respective ASCII code on the screen.
Construir un programa en JAVA que,
Pida al usuario ingresar por teclado una palabra de mínimo 6 caracteres, el software debe convertir esa palabra en
un arreglo tipo string, y luego visualizar en pantalla cada letra con su respectivo código ASCII.
P2Txx: two_vector_same
create a JAVA software that:
Automatically create two 50-position arrays with random numbers between 1 and 100 (numbers cannot be
repeated in the same vector). The software must traverse the two vectors and determine which numbers are
repeated and display them on the screen.
Construir un programa en JAVA que,
Cree automáticamente dos arreglos de 50 posiciones con números aleatorios entre 1 y 100 (no se pueden repetir
los números en el mismo vector). El software debe recorrer los dos vectores y determine cuales números están
repetidos y visualizarlos en pantalla.
P2Txx: mens_and_womens_ages
create a JAVA software that:
Automatically create two arrangements with 100 positions (one for women and one for men) in each vector will save the ages
that will be generated randomly between 1 and 100. The software should display how many:
• men and women are under the age of 18.
• men and women are equal to or over 18 but under 60.
• Men and women equal or over 60 years of age.
• Average age of women and men.
Construir un programa en JAVA que,
Cree automáticamente dos arreglos con 100 posiciones (uno para mujeres y otro para hombre) en cada vector se guardaran las
edades que se generaran de forma aleatoria entre 1 y 100. El software debe visualizar cuantos:
• hombres y mujeres son menores de 18 años.
• hombres y mujeres son iguales o mayores de 18 años pero menores de 60.
• Hombre y mujeres iguales o superan los 60 años de edad.
• Promedio de edad de mujeres y de hombres.
P2Txx: mens_and_womens_ages
create a JAVA software that:
Automatically create two arrangements with 100 positions (one for women and one for men) in each vector will save the ages
that will be generated randomly between 1 and 100. The software should display how many:
• men and women are under the age of 18.
• men and women are equal to or over 18 but under 60.
• Men and women equal or over 60 years of age.
• Average age of women and men.
Construir un programa en JAVA que,
Cree automáticamente dos arreglos con 100 posiciones (uno para mujeres y otro para hombre) en cada vector se guardaran las
edades que se generaran de forma aleatoria entre 1 y 100. El software debe visualizar cuantos:
• hombres y mujeres son menores de 18 años.
• hombres y mujeres son iguales o mayores de 18 años pero menores de 60.
• Hombre y mujeres iguales o superan los 60 años de edad.
• Promedio de edad de mujeres y de hombres.
P2Txx: delete_below_that_average
create a JAVA software that:
Automatically create an array with 20 positions (the value of each position will be a random number between 100
and 200). The software should calculate what is the average of generated values and clear all the values that are
below that average.
Note: you should display the original array, average and resulting array
Construir un programa en JAVA que,
Cree automáticamente un array con 20 posiciones (el valor de cada posición será un número aleatorio entre 100 y
200). El software debe calcular cual es el promedio de entre los valores generados y borrar todos los valores que
este por debajo de ese promedio.
Nota: debe visualizar el array original, el promedio y el array resultante
P2Txx: arrays_with_capiquaus
create a JAVA software that:
Automatically create an array with N positions (the value is typed by the user). The software must generate random
values between 1000 to 10000 to fill the array (numbers cannot be repeated). Additionally, you must indicate
which numbers are capiquaus (reads the same regardless of address).
Construir un programa en JAVA que,
Cree automáticamente un array con N posiciones(el valor es ingresado por el usuario). El software debe generar
valores aleatorios entre 1000 a 10000 para llenar el array (no se pueden repetir los números). Adicionalmente debe
indicar que números son capicuas (se lee igual sin importar la dirección).
P2Txx: arrays_repeated
create a JAVA software that:
Automatically create an array with N positions (the value is typed by the user). The software must generate random
values between 2 to 2222 to fill the array. In addition, you should display the average number on the screen and
display the elements of the array and in front of each value show the number of times that value is repeated in the
array.
Construir un programa en JAVA que,
Cree automáticamente un array con N posiciones (el valor es tecleado por el usuario). El software debe generar
valores aleatorios entre 2 a 2222 para llenar el array. Adicionalmente debe visualizar en la pantalla el promedio de
los números y visualizar los elementos del array y en frente de cada valor mostrar la cantidad de veces que se
repite ese valor en el array.
P2Txx: Hangman’s
create a JAVA software that:
Design the hangman's game with 10 different words (saved in a vector) of at least 4 characters, the software must randomly select
one of them and generate on screen a menu where stripes are displayed for each position of the letters.
The software requested that the user enter a letter, if the letter matches should be displayed on the screen.
The user can only fail 4 times otherwise it will generate a message saying "You have lost"
Construir un programa en JAVA que,
Diseñar el juego del ahorcado con 10 palabras diferentes (guardadas en un vector) de mínimo 4 caracteres, el software debe
seleccionar una de ellas aleatoriamente y generarle en pantalla un menú donde se visualicen rayas por cada posición de la letras.
El software pedida que el usuario ingrese una letra, si la letra coincide debe mostrarse en pantalla.
El usuario solo puede fallar 4 veces de lo contrario le generara un mensaje diciendo “Usted ha perdido”
Conceptos básicos
Ciclos
Métodos
Arreglos
Operaciones arreglos
matrices
persistencia
crud
Proyecto
JAVA arreglos unidimensionales y ciclos (FOR / WHILE)

Más contenido relacionado

Similar a JAVA arreglos unidimensionales y ciclos (FOR / WHILE)

Metodos numericos s14
Metodos numericos s14Metodos numericos s14
Metodos numericos s14
Maestros Online Mexico
 
Metodos numericos s14
Metodos numericos s14Metodos numericos s14
Metodos numericos s14
Maestros Online
 
Ejercicios
EjerciciosEjercicios
Trabajo grupal de ciclos repetitivos
Trabajo grupal de ciclos repetitivosTrabajo grupal de ciclos repetitivos
Trabajo grupal de ciclos repetitivosemidacent
 
Labo for while
Labo for whileLabo for while
Labo for while
Pierina Vicuña
 
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
1325210317
 
Ejercicios 7 programación
Ejercicios 7 programaciónEjercicios 7 programación
Ejercicios 7 programaciónEdgar0622
 
Ejercicos 3 con fundamentacion
Ejercicos 3 con fundamentacionEjercicos 3 con fundamentacion
Ejercicos 3 con fundamentacionJefferson Prieto
 
Compiladores e-interprete
Compiladores e-interprete Compiladores e-interprete
Compiladores e-interprete
Juan Carlos EV
 
Guía de Ejercicios de Programación Web Básica
Guía de Ejercicios de Programación Web BásicaGuía de Ejercicios de Programación Web Básica
Guía de Ejercicios de Programación Web Básica
José Ricardo Tillero Giménez
 
Guía De Ejercicios Programación Web Básica
Guía De Ejercicios Programación Web BásicaGuía De Ejercicios Programación Web Básica
Guía De Ejercicios Programación Web Básica
José Ricardo Tillero Giménez
 
Introducción a JavaScript 1
Introducción a JavaScript 1Introducción a JavaScript 1
Introducción a JavaScript 1Lorenzo Alejo
 
Variables
VariablesVariables
Variables
jugisabe
 
Trabajo de arreglo
Trabajo de arregloTrabajo de arreglo
Trabajo de arreglo
Sol Hernández
 
Ejercicios java
Ejercicios javaEjercicios java
Ejercicios java
Enrique Vargas
 

Similar a JAVA arreglos unidimensionales y ciclos (FOR / WHILE) (20)

Metodos numericos s14
Metodos numericos s14Metodos numericos s14
Metodos numericos s14
 
Metodos numericos s14
Metodos numericos s14Metodos numericos s14
Metodos numericos s14
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Trabajo grupal de ciclos repetitivos
Trabajo grupal de ciclos repetitivosTrabajo grupal de ciclos repetitivos
Trabajo grupal de ciclos repetitivos
 
Labo for while
Labo for whileLabo for while
Labo 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
 
Ejercicios 7 programación
Ejercicios 7 programaciónEjercicios 7 programación
Ejercicios 7 programación
 
Ejercicos 3 con fundamentacion
Ejercicos 3 con fundamentacionEjercicos 3 con fundamentacion
Ejercicos 3 con fundamentacion
 
Compiladores e-interprete
Compiladores e-interprete Compiladores e-interprete
Compiladores e-interprete
 
B05
B05B05
B05
 
B05
B05B05
B05
 
B05
B05B05
B05
 
B05
B05B05
B05
 
Guía de Ejercicios de Programación Web Básica
Guía de Ejercicios de Programación Web BásicaGuía de Ejercicios de Programación Web Básica
Guía de Ejercicios de Programación Web Básica
 
Guía De Ejercicios Programación Web Básica
Guía De Ejercicios Programación Web BásicaGuía De Ejercicios Programación Web Básica
Guía De Ejercicios Programación Web Básica
 
Introducción a JavaScript 1
Introducción a JavaScript 1Introducción a JavaScript 1
Introducción a JavaScript 1
 
Variables
VariablesVariables
Variables
 
Ejercicios de python
Ejercicios de pythonEjercicios de python
Ejercicios de python
 
Trabajo de arreglo
Trabajo de arregloTrabajo de arreglo
Trabajo de arreglo
 
Ejercicios java
Ejercicios javaEjercicios java
Ejercicios java
 

Último

Lecciones 10 Esc. Sabática. El espiritismo desenmascarado docx
Lecciones 10 Esc. Sabática. El espiritismo desenmascarado docxLecciones 10 Esc. Sabática. El espiritismo desenmascarado docx
Lecciones 10 Esc. Sabática. El espiritismo desenmascarado docx
Alejandrino Halire Ccahuana
 
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdfFORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
El Fortí
 
Biografía de Gregor Mendel y sus 3 leyes.pptx
Biografía de Gregor Mendel y sus 3 leyes.pptxBiografía de Gregor Mendel y sus 3 leyes.pptx
Biografía de Gregor Mendel y sus 3 leyes.pptx
ar5498718
 
JOSÉ MARÍA ARGUEDAS cuentos breves para secundaria
JOSÉ MARÍA ARGUEDAS cuentos breves para secundariaJOSÉ MARÍA ARGUEDAS cuentos breves para secundaria
JOSÉ MARÍA ARGUEDAS cuentos breves para secundaria
alegrialesliemarlene
 
Examen Lengua y Literatura EVAU Andalucía.pdf
Examen Lengua y Literatura EVAU Andalucía.pdfExamen Lengua y Literatura EVAU Andalucía.pdf
Examen Lengua y Literatura EVAU Andalucía.pdf
20minutos
 
SEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptx
SEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptxSEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptx
SEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptx
Osiris Urbano
 
el pensamiento critico de paulo freire en basica .pdf
el pensamiento critico de paulo freire en basica .pdfel pensamiento critico de paulo freire en basica .pdf
el pensamiento critico de paulo freire en basica .pdf
almitamtz00
 
665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf
665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf
665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf
valerytorresmendizab
 
Guia para Docentes como usar ChatGPT Mineduc Ccesa007.pdf
Guia para Docentes como usar ChatGPT  Mineduc Ccesa007.pdfGuia para Docentes como usar ChatGPT  Mineduc Ccesa007.pdf
Guia para Docentes como usar ChatGPT Mineduc Ccesa007.pdf
Demetrio Ccesa Rayme
 
UNA VISITA A SAN PEDRO EN EL VATICANO.pdf
UNA VISITA A SAN PEDRO EN EL VATICANO.pdfUNA VISITA A SAN PEDRO EN EL VATICANO.pdf
UNA VISITA A SAN PEDRO EN EL VATICANO.pdf
Joan Ribes Gallén
 
Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...
Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...
Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...
María Sánchez González (@cibermarikiya)
 
c3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptx
c3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptxc3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptx
c3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptx
Martín Ramírez
 
El Liberalismo económico en la sociedad y en el mundo
El Liberalismo económico en la sociedad y en el mundoEl Liberalismo económico en la sociedad y en el mundo
El Liberalismo económico en la sociedad y en el mundo
SandraBenitez52
 
Friedrich Nietzsche. Presentación de 2 de Bachillerato.
Friedrich Nietzsche. Presentación de 2 de Bachillerato.Friedrich Nietzsche. Presentación de 2 de Bachillerato.
Friedrich Nietzsche. Presentación de 2 de Bachillerato.
pablomarin116
 
Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.
Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.
Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.
20minutos
 
Tema 3-2 Aparato reproductor femenino 2024
Tema 3-2 Aparato reproductor femenino 2024Tema 3-2 Aparato reproductor femenino 2024
Tema 3-2 Aparato reproductor femenino 2024
IES Vicent Andres Estelles
 
Presentación Curso C. Diferencial - 2024-1.pdf
Presentación Curso C. Diferencial - 2024-1.pdfPresentación Curso C. Diferencial - 2024-1.pdf
Presentación Curso C. Diferencial - 2024-1.pdf
H4RV3YH3RN4ND3Z
 
Tema 3-3 Métodos anticonceptivos y ETS 2024
Tema 3-3 Métodos anticonceptivos y ETS 2024Tema 3-3 Métodos anticonceptivos y ETS 2024
Tema 3-3 Métodos anticonceptivos y ETS 2024
IES Vicent Andres Estelles
 
Guia Practica de ChatGPT para Docentes Ccesa007.pdf
Guia Practica de ChatGPT para Docentes Ccesa007.pdfGuia Practica de ChatGPT para Docentes Ccesa007.pdf
Guia Practica de ChatGPT para Docentes Ccesa007.pdf
Demetrio Ccesa Rayme
 
Presidencias radicales (1916 – 1930) (1) (1).pdf
Presidencias radicales (1916 – 1930) (1) (1).pdfPresidencias radicales (1916 – 1930) (1) (1).pdf
Presidencias radicales (1916 – 1930) (1) (1).pdf
MARIANA110300
 

Último (20)

Lecciones 10 Esc. Sabática. El espiritismo desenmascarado docx
Lecciones 10 Esc. Sabática. El espiritismo desenmascarado docxLecciones 10 Esc. Sabática. El espiritismo desenmascarado docx
Lecciones 10 Esc. Sabática. El espiritismo desenmascarado docx
 
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdfFORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
 
Biografía de Gregor Mendel y sus 3 leyes.pptx
Biografía de Gregor Mendel y sus 3 leyes.pptxBiografía de Gregor Mendel y sus 3 leyes.pptx
Biografía de Gregor Mendel y sus 3 leyes.pptx
 
JOSÉ MARÍA ARGUEDAS cuentos breves para secundaria
JOSÉ MARÍA ARGUEDAS cuentos breves para secundariaJOSÉ MARÍA ARGUEDAS cuentos breves para secundaria
JOSÉ MARÍA ARGUEDAS cuentos breves para secundaria
 
Examen Lengua y Literatura EVAU Andalucía.pdf
Examen Lengua y Literatura EVAU Andalucía.pdfExamen Lengua y Literatura EVAU Andalucía.pdf
Examen Lengua y Literatura EVAU Andalucía.pdf
 
SEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptx
SEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptxSEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptx
SEMIOLOGIA DE HEMORRAGIAS DIGESTIVAS.pptx
 
el pensamiento critico de paulo freire en basica .pdf
el pensamiento critico de paulo freire en basica .pdfel pensamiento critico de paulo freire en basica .pdf
el pensamiento critico de paulo freire en basica .pdf
 
665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf
665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf
665033394-TODAS-LAS-SANGRES-resumen-Por-Capitulos.pdf
 
Guia para Docentes como usar ChatGPT Mineduc Ccesa007.pdf
Guia para Docentes como usar ChatGPT  Mineduc Ccesa007.pdfGuia para Docentes como usar ChatGPT  Mineduc Ccesa007.pdf
Guia para Docentes como usar ChatGPT Mineduc Ccesa007.pdf
 
UNA VISITA A SAN PEDRO EN EL VATICANO.pdf
UNA VISITA A SAN PEDRO EN EL VATICANO.pdfUNA VISITA A SAN PEDRO EN EL VATICANO.pdf
UNA VISITA A SAN PEDRO EN EL VATICANO.pdf
 
Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...
Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...
Aprender-IA: Recursos online gratuitos para estar al tanto y familiarizarse c...
 
c3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptx
c3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptxc3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptx
c3.hu3.p3.p2.Superioridad e inferioridad en la sociedad.pptx
 
El Liberalismo económico en la sociedad y en el mundo
El Liberalismo económico en la sociedad y en el mundoEl Liberalismo económico en la sociedad y en el mundo
El Liberalismo económico en la sociedad y en el mundo
 
Friedrich Nietzsche. Presentación de 2 de Bachillerato.
Friedrich Nietzsche. Presentación de 2 de Bachillerato.Friedrich Nietzsche. Presentación de 2 de Bachillerato.
Friedrich Nietzsche. Presentación de 2 de Bachillerato.
 
Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.
Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.
Examen de Lengua Castellana y Literatura de la EBAU en Castilla-La Mancha 2024.
 
Tema 3-2 Aparato reproductor femenino 2024
Tema 3-2 Aparato reproductor femenino 2024Tema 3-2 Aparato reproductor femenino 2024
Tema 3-2 Aparato reproductor femenino 2024
 
Presentación Curso C. Diferencial - 2024-1.pdf
Presentación Curso C. Diferencial - 2024-1.pdfPresentación Curso C. Diferencial - 2024-1.pdf
Presentación Curso C. Diferencial - 2024-1.pdf
 
Tema 3-3 Métodos anticonceptivos y ETS 2024
Tema 3-3 Métodos anticonceptivos y ETS 2024Tema 3-3 Métodos anticonceptivos y ETS 2024
Tema 3-3 Métodos anticonceptivos y ETS 2024
 
Guia Practica de ChatGPT para Docentes Ccesa007.pdf
Guia Practica de ChatGPT para Docentes Ccesa007.pdfGuia Practica de ChatGPT para Docentes Ccesa007.pdf
Guia Practica de ChatGPT para Docentes Ccesa007.pdf
 
Presidencias radicales (1916 – 1930) (1) (1).pdf
Presidencias radicales (1916 – 1930) (1) (1).pdfPresidencias radicales (1916 – 1930) (1) (1).pdf
Presidencias radicales (1916 – 1930) (1) (1).pdf
 

JAVA arreglos unidimensionales y ciclos (FOR / WHILE)

  • 1.
  • 2. Faculty: Systems engineer Course: Introduction of Programming Topic: vectores y arreglos ________________________________________________ Socializer: Luis Fernando Castellanos Guarín Karen Daniela Cuervo Cely Email: Luis.castellanosg@usantoto.edu.co Karen.cuervo@usantoto.edu.co Phone: 3214582098 3105856930
  • 3. Topics Arreglos y ciclos • Presentación / Presentation • Ejercicios / Exercises
  • 4. Presentation Ejercicios en JAVA con para hacer uso de ciclos y arreglos unidimensionales (Vectores). A continuación crearemos software con el lenguaje JAVA que resuelva diversas problemáticas, donde dichas problemáticas las abordaremos usando ARREGLOS UNIDIMENSIONALES (VECTORES) y CICLOS (FOR /WHILE).
  • 6. P2Txx: vector with its indices create a JAVA software that: Automatically create an array of 10 randomly generated number positions between 1 and 100. Additionally, you can view them on the screen including your index and the value to which it corresponds. Note: Use methods (f_menu, f_make_array, f_show_array) Construir un programa en JAVA que, Cree automáticamente un arreglo (vector) de 10 posiciones de números generados aleatoriamente entre 1 y 100. Adicionalmente los visualice en pantalla incluyendo su índice y el valor al que corresponde. Nota: Utilice métodos (f_menu, f_crear_arreglo, f_visualizar_arreglo)
  • 7. P2Txx: Vector_number_multiple_of_five create a JAVA software that: Automatically create an array (vector) of N positions with random numbers between 1 and 50. In addition, display only numbers that are divisible by 5, for the above use methods (f_menu, f_create array, f_ multiple_five). Construir un programa en JAVA que, Cree automáticamente un arreglo (vector) de N posiciones con números randomicos entre 1 y 50. Adicionalmente que visualice únicamente los números que sean divisibles por 5, para lo anterior use métodos (f_menu, f_crear_arreglo, f_ver_multiplos_cinco).
  • 8. P2Txx: Vector with age of N people. create a JAVA software that: Generates the age randomly for N people and save them in a vector, with this information: • determine how many are over 18 and when they are under. • Those who are over 60 years old. • Average age. Construir un programa en JAVA que, Genere la edad de forma aleatoria para N personas y las guarde en un vector, con esta información: • determinar cuantos son mayores de 18 años y cuando son menores. • Cuantos tienen más de 60 años. • Promedio de edad.
  • 9. P2Txx: Vector with price of N products create a JAVA software that: Automatically generate a vector of 10 random numbers between 1 and 10 (the number cannot be repeated), then ask the user to enter a number, if the value entered is in the vector you will display a message that says "Congratulations, you’ve won 1,000,000 pesos", after four failed attempts the software will display a message that says "Sorry you have lost your chance". For this exercise, use the while cycle and methods for the processes. Construir un programa en JAVA que, Genere automáticamente un vector de 10 números aleatorios entre 1 y 10 (el número no se puede repetir), después solicite al usuario que ingrese un número, si el valor ingresado esta en el vector le visualizara un mensaje que diga “Felicitaciones usted ha ganado 1.000.000 de pesos”, si después de cuatro(4) oportunidades no logra adivinar el software le visualizara un mensaje que diga “Lo siento usted ha perdido su oportunidad”. Para este ejercicio utilice el ciclo while y métodos para los procesos.
  • 10. P2Txx: winning_number_machine create a JAVA software that: Automatically generate a vector of 10 random numbers between 1 and 10 (the number cannot be repeated), then ask the user to enter a number, if the value entered is in the vector you will display a message that says "Congratulations, you’ve won 1,000,000 pesos", after four failed attempts the software will display a message that says "Sorry you have lost your chance". For this exercise, use the while cycle and methods for the processes. Construir un programa en JAVA que, Genere automáticamente un vector de 10 números aleatorios entre 1 y 10 (el número no se puede repetir), después solicite al usuario que ingrese un número, si el valor ingresado esta en el vector le visualizara un mensaje que diga “Felicitaciones usted ha ganado 1.000.000 de pesos”, si después de cuatro(4) oportunidades no logra adivinar el software le visualizara un mensaje que diga “Lo siento usted ha perdido su oportunidad”. Para este ejercicio utilice el ciclo while y métodos para los procesos.
  • 11. P2Txx: words_and_ascii create a JAVA software that: Ask the user to enter a word of at least 6 characters by keyboard, the software must convert that word into a string array, and then display each letter with its respective ASCII code on the screen. Construir un programa en JAVA que, Pida al usuario ingresar por teclado una palabra de mínimo 6 caracteres, el software debe convertir esa palabra en un arreglo tipo string, y luego visualizar en pantalla cada letra con su respectivo código ASCII.
  • 12. P2Txx: two_vector_same create a JAVA software that: Automatically create two 50-position arrays with random numbers between 1 and 100 (numbers cannot be repeated in the same vector). The software must traverse the two vectors and determine which numbers are repeated and display them on the screen. Construir un programa en JAVA que, Cree automáticamente dos arreglos de 50 posiciones con números aleatorios entre 1 y 100 (no se pueden repetir los números en el mismo vector). El software debe recorrer los dos vectores y determine cuales números están repetidos y visualizarlos en pantalla.
  • 13. P2Txx: mens_and_womens_ages create a JAVA software that: Automatically create two arrangements with 100 positions (one for women and one for men) in each vector will save the ages that will be generated randomly between 1 and 100. The software should display how many: • men and women are under the age of 18. • men and women are equal to or over 18 but under 60. • Men and women equal or over 60 years of age. • Average age of women and men. Construir un programa en JAVA que, Cree automáticamente dos arreglos con 100 posiciones (uno para mujeres y otro para hombre) en cada vector se guardaran las edades que se generaran de forma aleatoria entre 1 y 100. El software debe visualizar cuantos: • hombres y mujeres son menores de 18 años. • hombres y mujeres son iguales o mayores de 18 años pero menores de 60. • Hombre y mujeres iguales o superan los 60 años de edad. • Promedio de edad de mujeres y de hombres.
  • 14. P2Txx: mens_and_womens_ages create a JAVA software that: Automatically create two arrangements with 100 positions (one for women and one for men) in each vector will save the ages that will be generated randomly between 1 and 100. The software should display how many: • men and women are under the age of 18. • men and women are equal to or over 18 but under 60. • Men and women equal or over 60 years of age. • Average age of women and men. Construir un programa en JAVA que, Cree automáticamente dos arreglos con 100 posiciones (uno para mujeres y otro para hombre) en cada vector se guardaran las edades que se generaran de forma aleatoria entre 1 y 100. El software debe visualizar cuantos: • hombres y mujeres son menores de 18 años. • hombres y mujeres son iguales o mayores de 18 años pero menores de 60. • Hombre y mujeres iguales o superan los 60 años de edad. • Promedio de edad de mujeres y de hombres.
  • 15. P2Txx: delete_below_that_average create a JAVA software that: Automatically create an array with 20 positions (the value of each position will be a random number between 100 and 200). The software should calculate what is the average of generated values and clear all the values that are below that average. Note: you should display the original array, average and resulting array Construir un programa en JAVA que, Cree automáticamente un array con 20 posiciones (el valor de cada posición será un número aleatorio entre 100 y 200). El software debe calcular cual es el promedio de entre los valores generados y borrar todos los valores que este por debajo de ese promedio. Nota: debe visualizar el array original, el promedio y el array resultante
  • 16. P2Txx: arrays_with_capiquaus create a JAVA software that: Automatically create an array with N positions (the value is typed by the user). The software must generate random values between 1000 to 10000 to fill the array (numbers cannot be repeated). Additionally, you must indicate which numbers are capiquaus (reads the same regardless of address). Construir un programa en JAVA que, Cree automáticamente un array con N posiciones(el valor es ingresado por el usuario). El software debe generar valores aleatorios entre 1000 a 10000 para llenar el array (no se pueden repetir los números). Adicionalmente debe indicar que números son capicuas (se lee igual sin importar la dirección).
  • 17. P2Txx: arrays_repeated create a JAVA software that: Automatically create an array with N positions (the value is typed by the user). The software must generate random values between 2 to 2222 to fill the array. In addition, you should display the average number on the screen and display the elements of the array and in front of each value show the number of times that value is repeated in the array. Construir un programa en JAVA que, Cree automáticamente un array con N posiciones (el valor es tecleado por el usuario). El software debe generar valores aleatorios entre 2 a 2222 para llenar el array. Adicionalmente debe visualizar en la pantalla el promedio de los números y visualizar los elementos del array y en frente de cada valor mostrar la cantidad de veces que se repite ese valor en el array.
  • 18. P2Txx: Hangman’s create a JAVA software that: Design the hangman's game with 10 different words (saved in a vector) of at least 4 characters, the software must randomly select one of them and generate on screen a menu where stripes are displayed for each position of the letters. The software requested that the user enter a letter, if the letter matches should be displayed on the screen. The user can only fail 4 times otherwise it will generate a message saying "You have lost" Construir un programa en JAVA que, Diseñar el juego del ahorcado con 10 palabras diferentes (guardadas en un vector) de mínimo 4 caracteres, el software debe seleccionar una de ellas aleatoriamente y generarle en pantalla un menú donde se visualicen rayas por cada posición de la letras. El software pedida que el usuario ingrese una letra, si la letra coincide debe mostrarse en pantalla. El usuario solo puede fallar 4 veces de lo contrario le generara un mensaje diciendo “Usted ha perdido”