mirror of
https://gitlab.com/tutorial-java-rafa-munoz/tutorial-java-2024-25/tutorialjava2024-25.git
synced 2025-11-10 02:13:07 +01:00
feat(cp): modified cp & some ch 1 to 4 examples
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
<attribute name="module" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package tutorialJava.capitulo2_condicionales;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class Ejemplo00_PrimerCondicional {
|
|
||||||
|
|
||||||
public static void unMetodo() {
|
|
||||||
int num;
|
|
||||||
|
|
||||||
num = (int) Math.round(Math.random() * 100);
|
|
||||||
|
|
||||||
System.out.println("El número al azar es: " + num);
|
|
||||||
|
|
||||||
if (num >= 0 && num <= 25) {
|
|
||||||
System.out.println("El número está entre 0 y 25");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (num > 25 && num <= 50) {
|
|
||||||
System.out.println("El número está entre 26 y 50");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println("El número es mayor de 50");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
unMetodo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -9,10 +9,10 @@ public class Ejemplo01_Condicionales {
|
|||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main (String args[]) {
|
public static void main (String args[]) {
|
||||||
// primerEjemploCondicionalSimple();
|
primerEjemploCondicionalSimple();
|
||||||
// ejemploCondicionalCompuesto();
|
// ejemploCondicionalCompuesto();
|
||||||
// ejemploCondicionalAnidado();
|
// ejemploCondicionalAnidado();
|
||||||
ejemploCondicionalMultiple();
|
// ejemploCondicionalMultiple();
|
||||||
// ejemploOperadorTernario();
|
// ejemploOperadorTernario();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package tutorialJava.capitulo2_condicionales;
|
|||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
public class EjemploMenu {
|
public class Ejemplo02_Menu {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String str;
|
String str;
|
||||||
@@ -11,7 +11,7 @@ public class Ejemplo01_Bucle_For {
|
|||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main (String args[]) {
|
public static void main (String args[]) {
|
||||||
// cuentaAdelanteYAtras();
|
cuentaAdelanteYAtras();
|
||||||
// cuentaAdelanteConMultiplos();
|
// cuentaAdelanteConMultiplos();
|
||||||
// tablaMultiplicar();
|
// tablaMultiplicar();
|
||||||
// mayorDeUnaSerieDeNumeros();
|
// mayorDeUnaSerieDeNumeros();
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ public class Ejemplo02_Bucle_While {
|
|||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main (String args[]) {
|
public static void main (String args[]) {
|
||||||
pedirNumerosAlUsuario();
|
cuentaAdelanteYCuentaAtras();
|
||||||
|
// pedirNumerosAlUsuario();
|
||||||
|
// pedirNumerosAlUsuarioYObtenerSuma();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ import tutorialJava.Utils;
|
|||||||
|
|
||||||
public class Ejemplo03_Bucle_DoWhile {
|
public class Ejemplo03_Bucle_DoWhile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
cuentaAdelante();
|
||||||
|
// cuentaAtras();
|
||||||
|
// pedirNumerosAlUsuario();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class Ej03_EjemploMatrices {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int m[][] = new int[4][3];
|
int m[][] = new int[4][3];
|
||||||
int m2[][] = new int[][] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};
|
// int m2[][] = new int[][] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};
|
||||||
|
|
||||||
int cont = 1;
|
int cont = 1;
|
||||||
for (int i = 0; i < m.length; i++) {
|
for (int i = 0; i < m.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user