├── .gitignore ├── 01_Variables ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg01_variables │ └── Main.java ├── 02_Operadores ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg02_operadores │ └── Main.java ├── 03_SentenciasControl ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg03_sentenciascontrol │ └── Main.java ├── 04_Ciclos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg04_ciclos │ └── Main.java ├── 05_UsoClases ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── Animales │ ├── MuestraPerro.java │ └── Perro.java ├── 06_Constructores ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── Animales │ ├── MuestraPerro.java │ └── Perro.java ├── 07_CalcularFiguras ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── Figuras │ ├── Cubo.java │ └── Resultado.java ├── 08_ValRef ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg08_valref │ ├── Animal.java │ └── Main.java ├── 09_Encapsular ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg09_encapsular │ ├── Animal.java │ └── Main.java ├── 10_Herencia ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg10_herencia │ ├── Animal.java │ ├── Main.java │ ├── Marino.java │ └── Terrestre.java ├── 11_Sobrecarga ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg11_sobrecarga │ ├── Main.java │ └── Operaciones.java ├── 12_Paquetes ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── IamLAM │ └── com │ │ └── tools.java │ └── pkg12_paquetes │ └── Main.java ├── 13_Arreglos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg13_arreglos │ ├── Animal.java │ └── Main.java ├── 14_Matrices ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── IamLAM │ └── com │ │ └── Animal.java │ └── pkg14_matrices │ └── Main.java ├── 15_Integrador ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── IamLAM │ └── com │ │ ├── Orden.java │ │ └── Producto.java │ └── pkg15_integrador │ └── Main.java ├── 16_Integrador ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── IamLAM │ └── com │ │ └── compras │ │ ├── Computadora.java │ │ ├── DispositivosEntrada.java │ │ ├── Monitor.java │ │ ├── Orden.java │ │ ├── Raton.java │ │ └── Teclado.java │ └── pkg16_integrador │ └── Main.java ├── 17_JavaDoc ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg17_javadoc │ ├── Main.java │ └── Operaciones.java ├── 18_VarArgs ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── IamLAM │ └── com │ └── Main.java ├── 19_Enum ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── IamLAM │ └── com │ ├── Estados.java │ └── Main.java ├── 20_ModificadoresAcceso ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── PaqueteDos │ ├── ClaseCuatro.java │ └── ClaseTres.java │ ├── PaqueteUno │ ├── ClaseDos.java │ └── ClaseUno.java │ └── modificadoresacceso │ └── ModificadoresAcceso.java ├── 21_Sobreescritura ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg21_sobreescritura │ ├── Empleado.java │ ├── Main.java │ └── Medico.java ├── 22_Polimorfismo ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg22_polimorfismo │ ├── Empleado.java │ ├── Gerente.java │ └── Polimorfismo.java ├── 23_ValidarInstancias ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg23_validarinstancias │ ├── Circulo.java │ ├── Elipse.java │ ├── FigurasGeometricas.java │ ├── Instancias.java │ ├── Rectangulo.java │ └── Triangulo.java ├── 24_Interfaces ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── datos │ ├── AccesoDatos.java │ ├── ImplementacionMySQL.java │ └── ImplementacionOracle.java │ └── pkg24_interfaces │ └── ManejoInterfaces.java ├── 25_Excepciones ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── domain │ ├── Division.java │ └── OperationException.java │ └── pkg25_excepciones │ ├── ManejoExcepciones.java │ └── ManejoExcepcionesArg.java ├── 26_ManejoColecciones ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg26_manejocolecciones │ └── ManejoColecciones.java ├── 27_ManejoGenericos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg27_manejogenericos │ ├── Generica.java │ └── ManejoGenericos.java ├── 28_ManejoCG ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg28_manejocg │ └── ManejoCG.java ├── 29_EntradaDatos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg29_entradadatos │ └── EntradaDatos.java ├── 30_EntradaDatos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg30_entradadatos │ └── EntradaDatos.java ├── 31_Calculadora ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg31_calculadora │ ├── Calculadora.java │ └── Operaciones.java ├── 32_ManejoArchivos ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── pkg32_manejoarchivos │ └── ManejoArchivos.java │ └── utileria │ └── Archivos.java ├── 33_ManejoMultimedia ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── IamLAM │ └── com │ │ └── peliculas │ │ ├── datos │ │ ├── AccesoDatos.java │ │ └── AccesoDatosImpl.java │ │ ├── domain │ │ └── Pelicula.java │ │ ├── excepciones │ │ ├── AccesoDatosEx.java │ │ ├── EscrituraDatosEx.java │ │ └── LecturaDatosEx.java │ │ └── negocio │ │ ├── CatalogoPeliculas.java │ │ └── CatalogoPeliculasImpl.java │ └── pkg33_manejomultimedia │ └── ManejoMultimedia.java ├── 34_JDBCConexión ├── build.xml ├── manifest.mf ├── mysql-driver.jar ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── pkg34_jdbcconexión │ └── JDBCConexion.java ├── 35_ManejoPersonal ├── build.xml ├── manifest.mf ├── mysql-driver.jar ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── datos │ ├── Conexion.java │ └── TrabajadorJDBC.java │ ├── domain │ └── Trabajador.java │ └── pkg35_manejopersonal │ └── ManejoPersonal.java ├── 36_ManejoTransacciones ├── build.xml ├── manifest.mf ├── mysql-driver.jar ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ ├── datos │ ├── Conexion.java │ └── TrabajadorJDBC.java │ ├── domain │ └── Trabajador.java │ └── pkg35_manejopersonal │ └── ManejoPersonal.java ├── README.md └── Saludos ├── build.xml ├── manifest.mf ├── nbproject ├── build-impl.xml ├── genfiles.properties ├── project.properties └── project.xml └── src └── saludos └── Saludos.java /.gitignore: -------------------------------------------------------------------------------- 1 | /Saludos/nbproject/private/ 2 | /Saludos/build/ 3 | /01_Variables/nbproject/private/ 4 | /01_Variables/build/ 5 | /02_Operadores/nbproject/private/ 6 | /02_Operadores/build/ 7 | /03_SentenciasControl/nbproject/private/ 8 | /03_SentenciasControl/build/ 9 | /04_Ciclos/nbproject/private/ 10 | /04_Ciclos/build/ 11 | /05_UsoClases/nbproject/private/ 12 | /05_UsoClases/build/ 13 | /06_Constructores/nbproject/private/ 14 | /06_Constructores/build/ 15 | /07_CalcularFiguras/nbproject/private/ 16 | /07_CalcularFiguras/build/ 17 | /08_ValRef/nbproject/private/ 18 | /08_ValRef/build/ 19 | /09_Encapsular/nbproject/private/ 20 | /09_Encapsular/build/ 21 | /10_Herencia/nbproject/private/ 22 | /10_Herencia/build/ 23 | /11_Sobrecarga/nbproject/private/ 24 | /11_Sobrecarga/build/ 25 | /12_Paquetes/nbproject/private/ 26 | /12_Paquetes/build/ 27 | /13_Arreglos/nbproject/private/ 28 | /13_Arreglos/build/ 29 | /Matrices/nbproject/private/ 30 | /14_Matrices/nbproject/private/ 31 | /14_Matrices/build/ 32 | /15_Integrador/nbproject/private/ 33 | /15_Integrador/build/ 34 | /16_Integrador/nbproject/private/ 35 | /16_Integrador/build/ 36 | /17_JavaDoc/nbproject/private/ 37 | /17_JavaDoc/build/ 38 | /17_JavaDoc/dist/ 39 | /18_VarArgs/nbproject/private/ 40 | /18_VarArgs/build/ 41 | /19_Enum/nbproject/private/ 42 | /19_Enum/build/ 43 | /20_ModificadoresAcceso/nbproject/private/ 44 | /20_ModificadoresAcceso/build/ 45 | /21_Sobreescritura/nbproject/private/ 46 | /21_Sobreescritura/build/ 47 | /22_Polimorfismo/nbproject/private/ 48 | /22_Polimorfismo/build/ 49 | /23_ValidarInstancias/nbproject/private/ 50 | /23_ValidarInstancias/build/ 51 | /24_Interfaces/nbproject/private/ 52 | /24_Interfaces/build/ 53 | /25_Excepciones/nbproject/private/ 54 | /25_Excepciones/build/ 55 | /26_ManejoColecciones/nbproject/private/ 56 | /26_ManejoColecciones/build/ 57 | /27_ManejoGenericos/nbproject/private/ 58 | /27_ManejoGenericos/build/ 59 | /28_ManejoCG/nbproject/private/ 60 | /28_ManejoCG/build/ 61 | /29_EntradaDatos/nbproject/private/ 62 | /29_EntradaDatos/build/ 63 | /30_EntradaDatos/nbproject/private/ 64 | /30_EntradaDatos/build/ 65 | /31_Calculadora/nbproject/private/ 66 | /31_Calculadora/build/ 67 | /32_ManejoArchivos/nbproject/private/ 68 | /32_ManejoArchivos/build/ 69 | /33_ManejoMultimedia/nbproject/private/ 70 | /33_ManejoMultimedia/build/ 71 | /34_JDBCConexión/nbproject/private/ 72 | /34_JDBCConexión/build/ 73 | /35_ManejoPersonal/nbproject/private/ 74 | /35_ManejoPersonal/build/ 75 | 34_JDBCConexión/ 76 | -------------------------------------------------------------------------------- /01_Variables/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /01_Variables/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=ba7f7eb8 2 | build.xml.script.CRC32=a2bed36c 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=ba7f7eb8 7 | nbproject/build-impl.xml.script.CRC32=bc931321 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /01_Variables/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/01_Variables.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg01_variables.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /01_Variables/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 01_Variables 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /02_Operadores/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /02_Operadores/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=735b5bca 2 | build.xml.script.CRC32=17ad5da3 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=735b5bca 7 | nbproject/build-impl.xml.script.CRC32=98cc0f02 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /02_Operadores/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/02_Operadores.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg02_operadores.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /02_Operadores/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 02_Operadores 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /02_Operadores/src/pkg02_operadores/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg02_operadores; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | System.out.println("Operadores\n"); 20 | System.out.println("========================================\n"); 21 | int a = 1 + 2; 22 | int b = a * 4; 23 | int c = b / 2; 24 | int d = c - a; 25 | int e = -d; 26 | System.out.println("a = " + a); 27 | System.out.println("b = " + b); 28 | System.out.println("c = " + c); 29 | System.out.println("d = " + d); 30 | System.out.println("e = " + e); 31 | System.out.println("x mod 10 = " + a % 2); 32 | 33 | a += 2; 34 | b -= 4; 35 | c *= a; 36 | System.out.println("a = " + a); 37 | System.out.println("b = " + b); 38 | System.out.println("c = " + c); 39 | a++; 40 | System.out.println("a = " + a); 41 | c = ++a; 42 | d = b++; 43 | System.out.println("b = " + b); 44 | System.out.println("c = " + c); 45 | System.out.println("d = " + d); 46 | boolean res = a < b; 47 | System.out.println("res = " + res); 48 | int min = (a < b) ? a : b; 49 | System.out.println("min = " + min); 50 | int i, j, k; 51 | i = j = k = 100; 52 | System.out.println("i = " + i); 53 | System.out.println("j = " + j); 54 | System.out.println("k = " + k); 55 | System.out.println("========================================\n"); 56 | 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /03_SentenciasControl/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /03_SentenciasControl/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=78c42378 2 | build.xml.script.CRC32=0efcb46f 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=78c42378 7 | nbproject/build-impl.xml.script.CRC32=4d0dc113 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /03_SentenciasControl/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 03_SentenciasControl 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /03_SentenciasControl/src/pkg03_sentenciascontrol/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg03_sentenciascontrol; 7 | 8 | 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Main { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | int a=5,b=6,c=7; 23 | 24 | if(a==b) 25 | { System.out.println("Las variables son iguales"); 26 | }else 27 | { 28 | System.out.println("Las variables son diferentes"); 29 | 30 | } 31 | 32 | System.out.println("================"); 33 | 34 | switch(a){ 35 | 36 | case 1: 37 | System.out.println("El valor es 1"); 38 | 39 | break; 40 | case 3: 41 | System.out.println("El valor es 3"); 42 | break; 43 | case 5: 44 | System.out.println("El valor es 5"); 45 | break; 46 | } 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /04_Ciclos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /04_Ciclos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=a40530da 2 | build.xml.script.CRC32=42efaf6f 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=a40530da 7 | nbproject/build-impl.xml.script.CRC32=42b1c364 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /04_Ciclos/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/04_Ciclos.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg04_ciclos.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /04_Ciclos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 04_Ciclos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /04_Ciclos/src/pkg04_ciclos/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg04_ciclos; 7 | 8 | import java.util.Scanner; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Main { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | int a = 1, b = 100; 23 | System.out.println("Introduce valor máximo para ciclar"); 24 | Scanner capturado=new Scanner(System.in); 25 | b=capturado.nextInt(); 26 | System.out.println("(D0)(WHILE)===============\n"); 27 | do { 28 | 29 | System.out.println("El valor es" + a); 30 | a++; 31 | } while (a < b); 32 | 33 | System.out.println("(WHILE)===============\n"); 34 | a = 1; 35 | while (a < b) { 36 | System.out.println("El valor es" + a); 37 | a++; 38 | } 39 | System.out.println("(FOR)===============\n"); 40 | for (a = 1; a < b; a++) { 41 | 42 | System.out.println("El valor es" + a); 43 | 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /05_UsoClases/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /05_UsoClases/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=4742d2e4 2 | build.xml.script.CRC32=93708e68 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=4742d2e4 7 | nbproject/build-impl.xml.script.CRC32=cf451e9f 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /05_UsoClases/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/05_UsoClases.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=Animales.MuestraPerro 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /05_UsoClases/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 05_UsoClases 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /05_UsoClases/src/Animales/MuestraPerro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Animales; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class MuestraPerro { 13 | public static void main(String args[]){ 14 | System.out.println("Muestra los valores iniciales"); 15 | Perro labrador=new Perro(); 16 | labrador.mostrar(); 17 | labrador.edad=5; 18 | labrador.sexo="hembra"; 19 | labrador.tipo="Labrador blanco"; 20 | labrador.mostrar(); 21 | labrador.ladrar(); 22 | labrador.cambiarSexo(); 23 | labrador.mostrar(); 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /05_UsoClases/src/Animales/Perro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Animales; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Perro { 13 | 14 | String tipo; 15 | int edad; 16 | String sexo; 17 | 18 | public void mostrar(){ 19 | 20 | System.out.println("El tipo de perro es "+this.tipo+" tiene la edad de "+this.edad+" el sexo del perro es "+this.sexo); 21 | 22 | } 23 | 24 | 25 | public void ladrar(){ 26 | System.out.println("Wofff wooofff"); 27 | } 28 | 29 | public String cambiarSexo(){ 30 | 31 | 32 | return this.sexo="Macho"; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /06_Constructores/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /06_Constructores/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=b1ab8b7e 2 | build.xml.script.CRC32=6f80cc8a 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=b1ab8b7e 7 | nbproject/build-impl.xml.script.CRC32=cbf82b95 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /06_Constructores/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/06_Constructores.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=Animales.MuestraPerro 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /06_Constructores/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 06_Constructores 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /06_Constructores/src/Animales/MuestraPerro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Animales; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class MuestraPerro { 13 | public static void main(String args[]){ 14 | System.out.println("Muestra los valores iniciales"); 15 | Perro labrador=new Perro(); 16 | System.out.println(labrador.ladrar()); 17 | 18 | Perro labrador2=new Perro("Labrador",10,"Hembra"); 19 | labrador2.mostrar(); 20 | System.out.println(labrador2.ladrar()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /06_Constructores/src/Animales/Perro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Animales; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Perro { 13 | 14 | String tipo; 15 | int edad; 16 | String sexo; 17 | 18 | 19 | /*Constructor vacio*/ 20 | 21 | Perro(){ 22 | 23 | } 24 | 25 | /* Constructor con argumentos*/ 26 | 27 | Perro(String t,int e,String s){ 28 | this.edad=e; 29 | this.tipo=t; 30 | this.sexo=s; 31 | } 32 | 33 | public void mostrar(){ 34 | 35 | System.out.println("El tipo de perro es "+this.tipo+" tiene la edad de "+this.edad+" el sexo del perro es "+this.sexo); 36 | 37 | } 38 | 39 | 40 | public String ladrar(){ 41 | return "Wofff wooofff dijo el perro " +this.tipo; 42 | } 43 | 44 | public String cambiarSexo(){ 45 | 46 | 47 | return this.sexo="Macho"; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /07_CalcularFiguras/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /07_CalcularFiguras/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=941093d0 2 | build.xml.script.CRC32=dfb0c261 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=941093d0 7 | nbproject/build-impl.xml.script.CRC32=546e1dd4 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /07_CalcularFiguras/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 07_CalcularFiguras 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /07_CalcularFiguras/src/Figuras/Cubo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Figuras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Cubo { 13 | 14 | int l,a,p; 15 | 16 | Cubo(){} 17 | 18 | Cubo(int largo,int ancho,int profundidad){ 19 | this.l=largo; 20 | this.a=ancho; 21 | this.p=profundidad; 22 | 23 | } 24 | 25 | int calcularVolumen(){ 26 | 27 | int resultado=this.l*this.a*this.p; 28 | return resultado; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /07_CalcularFiguras/src/Figuras/Resultado.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Figuras; 7 | 8 | import java.util.Scanner; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Resultado { 15 | 16 | public static void main(String args[]){ 17 | 18 | System.out.println("Proporciona el largo del cubo"); 19 | Scanner largo=new Scanner(System.in); 20 | int l=largo.nextInt(); 21 | System.out.println("Proporciona el ancho del cubo"); 22 | Scanner ancho=new Scanner(System.in); 23 | int a=ancho.nextInt(); 24 | System.out.println("Proporciona la profundidad del cubo"); 25 | Scanner profundo=new Scanner(System.in); 26 | int p=profundo.nextInt(); 27 | Cubo figura=new Cubo(l,a,p); 28 | 29 | int resultado=figura.calcularVolumen(); 30 | 31 | System.out.println("El valor obtenido es: "+resultado); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /08_ValRef/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /08_ValRef/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=d888d2fb 2 | build.xml.script.CRC32=602e5c35 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=d888d2fb 7 | nbproject/build-impl.xml.script.CRC32=d80a2691 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /08_ValRef/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/08_ValRef.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg08_valref.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /08_ValRef/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 08_ValRef 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /08_ValRef/src/pkg08_valref/Animal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg08_valref; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Animal { 13 | 14 | String nombre; 15 | String edad; 16 | 17 | 18 | public void asignarNombre(String nombre){ 19 | 20 | this.nombre=nombre; 21 | 22 | } 23 | 24 | public void cambiarNombre(String nombre){ 25 | 26 | this.nombre=nombre; 27 | 28 | } 29 | public String obtenerNombre(){ 30 | 31 | return this.nombre; 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /08_ValRef/src/pkg08_valref/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg08_valref; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | /*Enviamos valores por parametro para identificar 20 | zonas de valor de una variable 21 | */ 22 | int a=100; 23 | imprimirValor(a); 24 | modificarValor(a); 25 | imprimirValor(a); 26 | 27 | 28 | /*Modificación por referencia*/ 29 | 30 | Animal gato=new Animal(); 31 | gato.asignarNombre("Ruffles"); 32 | imprimirNombre(gato); 33 | modificarNombre(gato); 34 | imprimirNombre(gato); 35 | 36 | } 37 | 38 | 39 | public static void modificarNombre(Animal n){ 40 | n.cambiarNombre("Zeus"); 41 | 42 | } 43 | public static void imprimirNombre(Animal n){ 44 | System.out.println("El valor resultante es..." +n.obtenerNombre()); 45 | } 46 | 47 | public static void modificarValor(int v){ 48 | int a=v; 49 | System.out.println("El valor dentro de la función es.."+a); 50 | } 51 | 52 | public static void imprimirValor(int v){ 53 | System.out.println("El valor enviado es..."+v); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /09_Encapsular/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /09_Encapsular/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=5a1eb182 2 | build.xml.script.CRC32=36c8532c 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=5a1eb182 7 | nbproject/build-impl.xml.script.CRC32=2b1c6ce4 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /09_Encapsular/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/09_Encapsular.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg09_encapsular.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /09_Encapsular/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 09_Encapsular 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /09_Encapsular/src/pkg09_encapsular/Animal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg09_encapsular; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Animal { 13 | 14 | private String nombre; 15 | private int edad; 16 | private String dueno; 17 | private boolean adoptado; 18 | 19 | 20 | Animal(){} 21 | 22 | 23 | Animal(String n,int e,String d,boolean ad){ 24 | 25 | this.nombre=n; 26 | this.edad=e; 27 | this.dueno=d; 28 | this.adoptado=ad; 29 | 30 | } 31 | 32 | public String getNombre(){ 33 | 34 | return this.nombre; 35 | } 36 | 37 | public void setNombre(String n){ 38 | this.nombre=n; 39 | } 40 | 41 | 42 | public int getEdad(){ 43 | return this.edad; 44 | } 45 | 46 | public void setEdad(int e){ 47 | 48 | this.edad=e; 49 | } 50 | 51 | public String getDueno(){ 52 | 53 | return this.dueno; 54 | } 55 | 56 | public void setDueno(String d){ 57 | 58 | this.dueno=d; 59 | } 60 | 61 | public boolean getAdoptado(){ 62 | 63 | return this.adoptado; 64 | } 65 | 66 | public void setAdoptado(boolean ad){ 67 | 68 | this.adoptado=ad; 69 | } 70 | 71 | 72 | @Override 73 | public String toString(){ 74 | 75 | return "nombre: "+nombre+" edad: "+edad+" dueno: "+dueno+" adoptado: "+adoptado; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /09_Encapsular/src/pkg09_encapsular/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg09_encapsular; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | Animal perro = new Animal("Ruffles", 5, "El profesor Jirafales", true); 21 | 22 | System.out.println("El resultado del primer objeto es:" + perro.getNombre()); 23 | System.out.println("El resultado del primer objeto es:" + perro.toString()); 24 | 25 | Animal perico = new Animal("Doritos", 2, "Juan Camaney", false); 26 | 27 | System.out.println("El resultado del segundo objeto es:" + perico.getNombre()); 28 | System.out.println("El resultado del segundo objeto es:" + perico.toString()); 29 | 30 | Animal perro2 = new Animal(); 31 | 32 | perro2 = perro; 33 | 34 | perro.setAdoptado(false); 35 | 36 | //perro=null; 37 | //como perro2 y perro apuntan al mismo objeto ambos tienen el mismo valor 38 | System.out.println("El resultado del primer objeto es:" + perro2.getNombre()); 39 | System.out.println("El resultado del primer objeto es:" + perro2); 40 | 41 | System.out.println("El resultado del primer objeto es:" + perro.getNombre()); 42 | System.out.println("El resultado del primer objeto es:" + perro); 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /10_Herencia/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /10_Herencia/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=85e40b2f 2 | build.xml.script.CRC32=88db09b5 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=85e40b2f 7 | nbproject/build-impl.xml.script.CRC32=3d3b8dd1 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /10_Herencia/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/10_Herencia.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg10_herencia.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /10_Herencia/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 10_Herencia 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /10_Herencia/src/pkg10_herencia/Animal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg10_herencia; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Animal { 13 | 14 | public String nombre; 15 | private int edad; 16 | private String dueno; 17 | private boolean adoptado; 18 | 19 | public Animal() { 20 | } 21 | 22 | public Animal(String n) { 23 | this.nombre = n; 24 | } 25 | 26 | public Animal(String n, int e, String d, boolean ad) { 27 | 28 | this.nombre = n; 29 | this.edad = e; 30 | this.dueno = d; 31 | this.adoptado = ad; 32 | 33 | } 34 | 35 | public String getNombre() { 36 | 37 | return this.nombre; 38 | } 39 | 40 | public void setNombre(String n) { 41 | this.nombre = n; 42 | } 43 | 44 | public int getEdad() { 45 | return this.edad; 46 | } 47 | 48 | public void setEdad(int e) { 49 | 50 | this.edad = e; 51 | } 52 | 53 | public String getDueno() { 54 | 55 | return this.dueno; 56 | } 57 | 58 | public void setDueno(String d) { 59 | 60 | this.dueno = d; 61 | } 62 | 63 | public boolean getAdoptado() { 64 | 65 | return this.adoptado; 66 | } 67 | 68 | public void setAdoptado(boolean ad) { 69 | 70 | this.adoptado = ad; 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | 76 | return "[Animal]"+"nombre: " + nombre + " edad: " + edad + " dueno: " + dueno + " adoptado: " + adoptado; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /10_Herencia/src/pkg10_herencia/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg10_herencia; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | Terrestre an1 = new Terrestre("Pato", 2, "Peces"); 21 | System.out.println("El animal es [" + an1 + "]"); 22 | 23 | Terrestre an2 = new Terrestre("Leon", 4, "Carne"); 24 | an2.setEdad(5); 25 | an2.setAdoptado(true); 26 | an2.setDueno("Zoo SD"); 27 | System.out.println("El animal es [" + an2 + "]"); 28 | 29 | Marino an3 = new Marino(new java.util.Date()); 30 | System.out.println("El animal es [" + an3 + "]"); 31 | 32 | an3.setExtremidades(0); 33 | an3.setEdad(2); 34 | an3.setNombre("Ballena"); 35 | System.out.println("El animal es [" + an3 + "]"); 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /10_Herencia/src/pkg10_herencia/Marino.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg10_herencia; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Marino extends Animal { 15 | 16 | private int extremidades; 17 | private String alimento; 18 | private java.util.Date nacimiento; 19 | 20 | public Marino(Date nac) { 21 | this.nacimiento = nac; 22 | this.extremidades = extremidades; 23 | this.alimento = alimento; 24 | } 25 | 26 | public Date nacimiento() { 27 | 28 | return nacimiento; 29 | } 30 | 31 | public int getExtremidades() { 32 | 33 | return this.extremidades; 34 | } 35 | 36 | public String getTipoAlimento() { 37 | 38 | return this.alimento; 39 | } 40 | 41 | public void setExtremidades(int ex) { 42 | 43 | this.extremidades = ex; 44 | } 45 | 46 | public void setTipoAlimento(String al) { 47 | 48 | this.alimento = al; 49 | } 50 | @Override 51 | public String toString() { 52 | 53 | return super.toString()+ "[Marino]"+" extremidades: "+ extremidades+" alimento: "+alimento+" nacimiento: "+nacimiento; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /10_Herencia/src/pkg10_herencia/Terrestre.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg10_herencia; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Terrestre extends Animal { 13 | 14 | private int extremidades; 15 | private String alimento; 16 | 17 | public Terrestre(String n,int ex, String al) { 18 | super(n); 19 | this.extremidades = ex; 20 | this.alimento = al; 21 | } 22 | 23 | public int getExtremidades() { 24 | 25 | return this.extremidades; 26 | } 27 | 28 | public String getTipoAlimento() { 29 | 30 | return this.alimento; 31 | } 32 | 33 | public void setExtremidades(int ex) { 34 | 35 | this.extremidades = ex; 36 | } 37 | 38 | public void setTipoAlimento(String al) { 39 | 40 | this.alimento = al; 41 | } 42 | 43 | 44 | @Override 45 | public String toString() { 46 | 47 | return super.toString()+ "[Terrestre]"+" extremidades: "+ extremidades+" alimento: "+alimento; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /11_Sobrecarga/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /11_Sobrecarga/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1a30cd38 2 | build.xml.script.CRC32=2b312f5a 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=1a30cd38 7 | nbproject/build-impl.xml.script.CRC32=7c471303 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /11_Sobrecarga/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/11_Sobrecarga.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg11_sobrecarga.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /11_Sobrecarga/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 11_Sobrecarga 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /11_Sobrecarga/src/pkg11_sobrecarga/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg11_sobrecarga; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | System.out.println(Operaciones.resta(2,3)); 21 | 22 | System.out.println(Operaciones.resta(4.5,2.3)); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /11_Sobrecarga/src/pkg11_sobrecarga/Operaciones.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg11_sobrecarga; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Operaciones { 13 | 14 | 15 | 16 | public static int resta(int a,int b){ 17 | System.out.println("int resta(int a,int b)="); 18 | return a-b; 19 | 20 | } 21 | 22 | public static double resta(double a,double b){ 23 | System.out.println("float resta(float a,float b)="); 24 | return a-b; 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /12_Paquetes/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /12_Paquetes/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=e584fec9 2 | build.xml.script.CRC32=703e89f4 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=e584fec9 7 | nbproject/build-impl.xml.script.CRC32=8a9b530f 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /12_Paquetes/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/12_Paquetes.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg12_paquetes.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /12_Paquetes/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 12_Paquetes 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /12_Paquetes/src/IamLAM/com/tools.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class tools { 13 | 14 | public static void desplegar(){ 15 | 16 | System.out.println("Mensaje desde tools paqueteria"); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /12_Paquetes/src/pkg12_paquetes/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg12_paquetes; 7 | import IamLAM.com.tools; 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | tools.desplegar(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /13_Arreglos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /13_Arreglos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=a669bf5a 2 | build.xml.script.CRC32=369959a6 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=a669bf5a 7 | nbproject/build-impl.xml.script.CRC32=d2147997 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /13_Arreglos/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/13_Arreglos.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg13_arreglos.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /13_Arreglos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 13_Arreglos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /13_Arreglos/src/pkg13_arreglos/Animal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg13_arreglos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Animal { 13 | 14 | private String nombre; 15 | 16 | public Animal(String n){ 17 | 18 | this.nombre=n; 19 | } 20 | 21 | public String getNombre(){ 22 | 23 | return nombre; 24 | } 25 | 26 | public void setNombre(String n){ 27 | 28 | this.nombre=n; 29 | } 30 | 31 | @Override 32 | public String toString(){ 33 | 34 | return "[Animal]="+"nombre: "+getNombre(); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /13_Arreglos/src/pkg13_arreglos/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg13_arreglos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | int edades[]; 21 | 22 | edades=new int[5]; 23 | 24 | edades[0]=1; 25 | edades[1]=10; 26 | edades[3]=100; 27 | System.out.println("edades[0]= "+edades[0]); 28 | System.out.println("edades[1]= "+edades[1]); 29 | System.out.println("edades[2]= "+edades[2]); 30 | System.out.println("edades[3]= "+edades[3]); 31 | System.out.println("edades[4]= "+edades[4]); 32 | 33 | Animal an[]; 34 | 35 | an=new Animal[5]; 36 | 37 | an[0]=new Animal("perro"); 38 | an[1]=new Animal("gato"); 39 | an[2]=new Animal("jirafa"); 40 | 41 | System.out.println("Animal[0]= "+an[0]); 42 | System.out.println("Animal[1]= "+an[1]); 43 | System.out.println("Animal[2]= "+an[2]); 44 | System.out.println("Animal[3]= "+an[3]); 45 | System.out.println("Animal[4]= "+an[4]); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /14_Matrices/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /14_Matrices/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=e6f2d890 2 | build.xml.script.CRC32=960741f1 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=e6f2d890 7 | nbproject/build-impl.xml.script.CRC32=7b5407d8 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /14_Matrices/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/14_Matrices.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg14_matrices.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /14_Matrices/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 14_Matrices 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /14_Matrices/src/IamLAM/com/Animal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Animal { 13 | private String nombre; 14 | 15 | public Animal(String n){ 16 | 17 | this.nombre=n; 18 | } 19 | 20 | public String getNombre(){ 21 | 22 | return nombre; 23 | } 24 | 25 | public void setNombre(String n){ 26 | 27 | this.nombre=n; 28 | } 29 | 30 | @Override 31 | public String toString(){ 32 | 33 | return "[Animal]="+"nombre: "+getNombre(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /14_Matrices/src/pkg14_matrices/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg14_matrices; 7 | 8 | import IamLAM.com.Animal; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Main { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | 23 | /*matrices de numeros*/ 24 | int[][] numeros; 25 | int numeros2[][] = {{2, 2}, {5, 6}}; 26 | numeros = new int[2][2]; 27 | numeros[0][0] = 6; 28 | numeros[0][1] = 5; 29 | numeros[1][0] = 3; 30 | numeros[1][1] = 8; 31 | 32 | System.out.println(" numeros[0][0]=" + numeros[0][0]); 33 | System.out.println(" numeros[0][1]=" + numeros[0][1]); 34 | System.out.println(" numeros[1][0]=" + numeros[1][0]); 35 | System.out.println(" numeros[1][1]=" + numeros[1][1]); 36 | 37 | System.out.println(" Tamaño matriz numeros(r)=" + numeros.length); 38 | System.out.println(" Tamaño matriz numeros(c)=" + numeros[0].length); 39 | 40 | 41 | 42 | /*Objetos*/ 43 | Animal zoo[][]; 44 | 45 | zoo = new Animal[3][3]; 46 | 47 | zoo[0][0] = new Animal("Perro"); 48 | zoo[0][1] = new Animal("Gato"); 49 | zoo[0][2] = new Animal("Perico"); 50 | 51 | zoo[1][0] = new Animal("Puerco"); 52 | zoo[1][1] = new Animal("Chimpance"); 53 | zoo[1][2] = new Animal("Caballo"); 54 | 55 | zoo[2][0] = new Animal("Hipopotamo"); 56 | zoo[2][1] = new Animal("Tigre"); 57 | zoo[2][2] = new Animal("Iguana"); 58 | 59 | for (int i = 0; i < zoo.length; i++) { 60 | 61 | for (int j = 0; j < zoo[i].length; j++) { 62 | System.out.println("[" + zoo[i][j] + "]"); 63 | } 64 | } 65 | 66 | /*matrices de cadenas*/ 67 | String zoo2[][]={{"perro","gato","perico"},{"puerco","chimance","caballo"},{"hipopotamo","tigre","iguana"}}; 68 | 69 | 70 | 71 | 72 | 73 | for (int i = 0; i < zoo2.length; i++) { 74 | 75 | for (int j = 0; j < zoo2[i].length; j++) { 76 | System.out.println("[" + zoo2[i][j] + "]\r"); 77 | } 78 | } 79 | 80 | 81 | 82 | 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /15_Integrador/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /15_Integrador/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=c2ac4fd9 2 | build.xml.script.CRC32=2c23b89e 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=c2ac4fd9 7 | nbproject/build-impl.xml.script.CRC32=25c39fae 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /15_Integrador/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/15_Integrador.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg15_integrador.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /15_Integrador/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 15_Integrador 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /15_Integrador/src/IamLAM/com/Orden.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Orden { 13 | 14 | private final int idOrden; 15 | private final Producto productos[]; 16 | private static int co; 17 | private int cp; 18 | private static final int mp = 5; 19 | 20 | public Orden() { 21 | this.idOrden = ++co; 22 | productos = new Producto[mp]; 23 | 24 | } 25 | 26 | public void agregarProducto(Producto p) { 27 | 28 | if (cp < mp) { 29 | productos[cp++] = p; 30 | } else { 31 | 32 | System.out.println("Ha superado el limite de compra " + mp); 33 | } 34 | } 35 | 36 | public double calcularTotal() { 37 | 38 | double t = 0; 39 | for (int i = 0; i < cp; i++) { 40 | t += productos[i].getPrecio(); 41 | } 42 | 43 | return t; 44 | 45 | } 46 | 47 | public void mostrarOrden() { 48 | 49 | System.out.println("#orden: " + idOrden); 50 | System.out.println("Costo total: " + calcularTotal()); 51 | System.out.println("Productos consumidos: "); 52 | for (int i = 0; i < cp; i++) { 53 | 54 | System.out.println(productos[i]); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /15_Integrador/src/IamLAM/com/Producto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Producto { 13 | 14 | private int idProducto; 15 | private String nombre; 16 | private double precio; 17 | private static int cp; 18 | 19 | private Producto() { 20 | this.idProducto = ++cp; 21 | } 22 | 23 | public Producto(String n, double p) { 24 | this(); 25 | this.precio = p; 26 | this.nombre = n; 27 | } 28 | 29 | public String getNombre() { 30 | 31 | return nombre; 32 | } 33 | 34 | public void setNombre(String n) { 35 | this.nombre = n; 36 | } 37 | 38 | public double getPrecio() { 39 | 40 | return precio; 41 | } 42 | 43 | public void getPrecio(double p) { 44 | 45 | this.precio = p; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | 51 | return "[Producto]:" + idProducto + " " + nombre + " " + precio; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /15_Integrador/src/pkg15_integrador/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg15_integrador; 7 | import IamLAM.com.Orden; 8 | import IamLAM.com.Producto; 9 | /** 10 | * 11 | * @author Luis Monge 12 | */ 13 | public class Main { 14 | 15 | /** 16 | * @param args the command line arguments 17 | */ 18 | public static void main(String[] args) { 19 | // TODO code application logic here 20 | 21 | Producto p=new Producto("Tostitos",15); 22 | Producto p2=new Producto("Cacahuates",5); 23 | Producto p3=new Producto("Chile en polvo",10); 24 | 25 | 26 | Orden or=new Orden(); 27 | or.agregarProducto(p); 28 | or.agregarProducto(p2); 29 | or.agregarProducto(p3); 30 | or.mostrarOrden(); 31 | 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /16_Integrador/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /16_Integrador/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=641412b6 2 | build.xml.script.CRC32=843b1edc 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=641412b6 7 | nbproject/build-impl.xml.script.CRC32=108daa9f 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /16_Integrador/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/16_Integrador.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg16_integrador.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /16_Integrador/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 16_Integrador 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /16_Integrador/src/IamLAM/com/compras/Computadora.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.compras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Computadora { 13 | 14 | private int idComputadora; 15 | private String nombre; 16 | private Monitor monitor; 17 | private Teclado teclado; 18 | private Raton raton; 19 | private static int cc; 20 | 21 | private Computadora() { 22 | 23 | idComputadora = ++cc; 24 | 25 | } 26 | 27 | public Computadora(String n, Monitor m, Teclado t, Raton r) { 28 | this(); 29 | this.nombre = n; 30 | this.teclado = t; 31 | this.raton = r; 32 | this.monitor = m; 33 | 34 | } 35 | 36 | public String getNombre() { 37 | 38 | return nombre; 39 | } 40 | 41 | public Teclado getTeclado() { 42 | 43 | return teclado; 44 | } 45 | 46 | public Raton getRaton() { 47 | 48 | return raton; 49 | } 50 | 51 | public Monitor getMonitor() { 52 | return monitor; 53 | } 54 | 55 | public void setMonitor(Monitor m) { 56 | 57 | this.monitor = m; 58 | 59 | } 60 | 61 | public void setRaton(Raton r) { 62 | 63 | this.raton = r; 64 | 65 | } 66 | 67 | public void setTeclado(Teclado t) { 68 | 69 | this.teclado = t; 70 | } 71 | 72 | public void setNombre(String n) { 73 | 74 | this.nombre = n; 75 | } 76 | 77 | 78 | @Override 79 | 80 | public String toString(){ 81 | 82 | return "[Computadora]="+"idComputadora:"+idComputadora+" "+nombre+" "+monitor+" "+teclado+" "+raton; 83 | 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /16_Integrador/src/IamLAM/com/compras/DispositivosEntrada.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.compras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class DispositivosEntrada { 13 | 14 | private String tipoEntrada; 15 | private String marca; 16 | 17 | public DispositivosEntrada(String te, String m) { 18 | this.marca = m; 19 | this.tipoEntrada = te; 20 | 21 | } 22 | 23 | public String getTipoEntrada() { 24 | 25 | return tipoEntrada; 26 | } 27 | 28 | public String getMarca() { 29 | 30 | return marca; 31 | } 32 | 33 | public void setTipoEntrada(String te) { 34 | this.tipoEntrada = te; 35 | 36 | } 37 | 38 | public void setMarca(String m) { 39 | 40 | this.marca = m; 41 | 42 | } 43 | 44 | @Override 45 | 46 | public String toString() { 47 | 48 | return "[Dispositivo Entrada]=" + tipoEntrada + marca; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /16_Integrador/src/IamLAM/com/compras/Monitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.compras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Monitor { 13 | 14 | private final int idMonitor; 15 | private String marca; 16 | private double tamano; 17 | private int cm; 18 | 19 | private Monitor() { 20 | 21 | idMonitor = ++cm; 22 | 23 | } 24 | 25 | public Monitor(String m, double t) { 26 | this(); 27 | this.marca = m; 28 | this.tamano = t; 29 | 30 | } 31 | 32 | public String getMarca() { 33 | 34 | return marca; 35 | } 36 | 37 | public double getTamano() { 38 | 39 | return tamano; 40 | } 41 | 42 | public void setTamano(double t) { 43 | 44 | this.tamano = t; 45 | } 46 | 47 | public void setMarca(String m) { 48 | this.marca = m; 49 | 50 | } 51 | 52 | public String toString() { 53 | 54 | return "\n[Dispositivo Entrada:Monitor]="+idMonitor+" "+ marca + " " + tamano+"\n"; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /16_Integrador/src/IamLAM/com/compras/Orden.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.compras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Orden { 13 | 14 | private final int idOrden; 15 | private final Computadora computadoras[]; 16 | private static int co; 17 | private int com; 18 | private static final int MAXCOM = 5; 19 | 20 | public Orden() { 21 | 22 | this.idOrden = ++co; 23 | computadoras = new Computadora[MAXCOM]; 24 | } 25 | 26 | public void agregarComputadora(Computadora c) { 27 | 28 | if (co < MAXCOM) { 29 | computadoras[com++] = c; 30 | } else { 31 | 32 | System.out.println("No se pueden realizar mas compras limite " + MAXCOM); 33 | } 34 | 35 | } 36 | 37 | public void mostrarOrden() { 38 | System.out.println("Orden #:" + idOrden); 39 | System.out.println("Computadoras de la orden #" + idOrden + ":"); 40 | for (int i = 0; i < com; i++) { 41 | System.out.println(computadoras[i]); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /16_Integrador/src/IamLAM/com/compras/Raton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.compras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Raton extends DispositivosEntrada { 13 | 14 | private final int idRaton; 15 | private static int cr; 16 | 17 | public Raton(String tp, String m) { 18 | super(tp, m); 19 | idRaton= ++cr; 20 | 21 | } 22 | 23 | 24 | @Override 25 | 26 | public String toString(){ 27 | 28 | return "[Dispositivo Entrada:Raton]="+idRaton+" "+cr+super.toString()+"\n"; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /16_Integrador/src/IamLAM/com/compras/Teclado.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.compras; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Teclado extends DispositivosEntrada { 13 | private final int idTeclado; 14 | private static int ct; 15 | 16 | public Teclado(String tp,String n) 17 | { 18 | super(tp,n); 19 | idTeclado=++ct; 20 | 21 | } 22 | 23 | public String toString(){ 24 | 25 | return "[Dispositivo Entrada:Teclado]="+idTeclado+" "+ct+super.toString()+"\n"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /16_Integrador/src/pkg16_integrador/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg16_integrador; 7 | 8 | import IamLAM.com.compras.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Main { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | Monitor m = new Monitor("Dell", 15); 23 | Teclado t = new Teclado("PS/2", "Dell"); 24 | Raton r = new Raton("PS/2", "Dell"); 25 | 26 | Computadora c = new Computadora("Dell", m, t, r); 27 | 28 | Orden or=new Orden(); 29 | or.agregarComputadora(c); 30 | or.mostrarOrden(); 31 | 32 | 33 | Monitor m2 = new Monitor("HP", 15); 34 | Teclado t2 = new Teclado("USB", "Dell"); 35 | Raton r2 = new Raton("USB", "Dell"); 36 | 37 | Computadora ensamblada = new Computadora("Ensamblada", m2, t2, r2); 38 | Orden or2=new Orden(); 39 | or2.agregarComputadora(ensamblada); 40 | or2.mostrarOrden(); 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /17_JavaDoc/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /17_JavaDoc/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=804816b4 2 | build.xml.script.CRC32=941bc506 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=804816b4 7 | nbproject/build-impl.xml.script.CRC32=955469ee 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /17_JavaDoc/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/17_JavaDoc.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg17_javadoc.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /17_JavaDoc/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 17_JavaDoc 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /17_JavaDoc/src/pkg17_javadoc/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg17_javadoc; 7 | 8 | /** 9 | * Ejercicio basico para comprobar el funcionamiento de javadoc 10 | * 11 | * @author IamLAM 12 | * @version 1.0 13 | */ 14 | public class Main { 15 | 16 | /** 17 | * Función principal para ejecutar la clase de operaciones 18 | * 19 | * @param args the command line arguments 20 | */ 21 | public static void main(String[] args) { 22 | // TODO code application logic here 23 | 24 | Operaciones ops = new Operaciones(); 25 | Operaciones opr = new Operaciones(); 26 | 27 | System.out.println(ops.sumar(5, 4)); 28 | System.out.println(ops.restar(5, 4)); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /17_JavaDoc/src/pkg17_javadoc/Operaciones.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg17_javadoc; 7 | 8 | /** 9 | *Ejercicio basico para comprobar el funcionamiento de javadoc 10 | * @author IamLAM 11 | * @version 1.0 12 | */ 13 | public class Operaciones { 14 | 15 | /** 16 | * 17 | * Variables para base para realizar operaciones 18 | */ 19 | int a; 20 | int b; 21 | 22 | 23 | Operaciones(){} 24 | 25 | /** 26 | * 27 | * @param a 28 | * @param b 29 | */ 30 | Operaciones(int a,int b){ 31 | 32 | this.a=a; 33 | this.b=b; 34 | } 35 | 36 | /** 37 | * Este metodo ayudara a realizar una sumatoria de dos valores 38 | * @param a 39 | * @param b 40 | * @return regresa un valor tipo entero de suma 41 | */ 42 | public int sumar(int a , int b){ 43 | 44 | return a+b; 45 | 46 | } 47 | /** 48 | * Este metodo ayudara a realizar una resta de dos valores 49 | * @param a 50 | * @param b 51 | * @return regresa la resta de un valor 52 | */ 53 | 54 | public int restar(int a , int b){ 55 | 56 | return a-b; 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /18_VarArgs/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /18_VarArgs/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=f31ea78e 2 | build.xml.script.CRC32=f62d5462 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=f31ea78e 7 | nbproject/build-impl.xml.script.CRC32=558bb377 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /18_VarArgs/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/18_VarArgs.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=IamLAM.com.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /18_VarArgs/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 18_VarArgs 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /18_VarArgs/src/IamLAM/com/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | 21 | desplegar(33,5,6,8,9,7,9); 22 | 23 | 24 | 25 | } 26 | 27 | 28 | public static void desplegar(int ... n){ 29 | //usando un foreach 30 | for(int num : n){ 31 | System.out.println(num); 32 | 33 | } 34 | System.out.println("Classica mode"); 35 | //forma clasica 36 | for(int i=0;i 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 19_Enum 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /19_Enum/src/IamLAM/com/Estados.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public enum Estados { 13 | 14 | BC, 15 | BCS, 16 | COL, 17 | SON, 18 | DF, 19 | YUC, 20 | TAB 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /19_Enum/src/IamLAM/com/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | System.out.println(Estados.BC); 21 | 22 | desplegar(Estados.SON); 23 | 24 | } 25 | 26 | public static void desplegar(Estados edo) { 27 | 28 | switch (edo) { 29 | 30 | case BC: 31 | System.out.println("Es Baja California"); 32 | break; 33 | 34 | case BCS: 35 | System.out.println("Es Baja California Sur"); 36 | break; 37 | 38 | default: 39 | System.out.println("No se encuentra registrado el Estado"); 40 | break; 41 | 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=13f10f63 2 | build.xml.script.CRC32=5df8969a 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=13f10f63 7 | nbproject/build-impl.xml.script.CRC32=38c1eb42 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 20_ModificadoresAcceso 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/src/PaqueteDos/ClaseCuatro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package PaqueteDos; 7 | 8 | 9 | import PaqueteUno.ClaseUno; 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class ClaseCuatro { 15 | 16 | 17 | public ClaseCuatro(){ 18 | 19 | 20 | } 21 | 22 | 23 | 24 | public void desplegarClaseCuatro(){ 25 | 26 | ClaseUno c = new ClaseUno(); 27 | 28 | System.out.println("Acceso a variables ClaseUno"); 29 | System.out.println("Variable publica " + c.vPublica); 30 | 31 | System.out.println("Variable default,private, protected no tiene acceso clases que no pertenezcan al mismo paquete o heredadas"); 32 | 33 | 34 | 35 | System.out.println("Acceso a metodos ClaseUno en Clase Heredada (Cuatro)"); 36 | System.out.println("Metodo publico " + c.desplegarPublico()); 37 | 38 | System.out.println("Metodo protegido,privado y package no es accesible desde paquetes que no pertenezcan ni hereden"); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/src/PaqueteDos/ClaseTres.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package PaqueteDos; 7 | 8 | import PaqueteUno.ClaseUno; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class ClaseTres extends ClaseUno{ 15 | 16 | public ClaseTres(){ 17 | 18 | //Acceso al constructor protegido 19 | super(100,200); 20 | //Acceso al constructor package 21 | //super(100,200,300,400); 22 | //Acceso publico 23 | // super(100); 24 | //Acceso privado 25 | //super(100,200,300); 26 | } 27 | 28 | public void desplegarClaseTres(){ 29 | 30 | ClaseUno c = new ClaseUno(); 31 | 32 | System.out.println("Acceso a variables ClaseUno"); 33 | System.out.println("Variable publica " + c.vPublica); 34 | System.out.println("Variable protegida " + vProtegida); 35 | System.out.println("Variable default no tiene acceso en herencias"); 36 | System.out.println("Variable private no tiene acceso en herencias"); 37 | 38 | 39 | System.out.println("Acceso a metodos ClaseUno en Clase Heredada (Tres)"); 40 | System.out.println("Metodo publico " + c.desplegarPublico()); 41 | System.out.println("Metodo protegido " + desplegarProtegido()); 42 | System.out.println("Metodo privado y package no es accesible en herencias"); 43 | 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/src/PaqueteUno/ClaseDos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package PaqueteUno; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class ClaseDos { 13 | 14 | public ClaseDos() { 15 | System.out.println("Acceso ClaseDos"); 16 | 17 | new ClaseUno(100); 18 | new ClaseUno(100, 200); 19 | //new ClaseUno(100,200,300); 20 | new ClaseUno(100, 200, 300, 400); 21 | System.out.println("Acceso restringido al constructor private"); 22 | } 23 | 24 | public void desplegarClaseDos() { 25 | 26 | ClaseUno c = new ClaseUno(); 27 | 28 | System.out.println("Acceso a variables ClaseUno"); 29 | System.out.println("Variable publica " + c.vPublica); 30 | System.out.println("Variable paquete " + c.vPaquete); 31 | System.out.println("Variable protegida" + c.vProtegida); 32 | 33 | System.out.println("No se tiene acceso a variable privada desde el propio paquete"); 34 | 35 | System.out.println("Acceso a metodos ClaseUno"); 36 | System.out.println("Metodo publico " + c.desplegarPublico()); 37 | System.out.println("Metodo protegido " + c.desplegarProtegido()); 38 | System.out.println("Metodo paquete " + c.desplegarPaquete()); 39 | 40 | System.out.println("Metodo privado no es accesible desde el propio paquete"); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/src/PaqueteUno/ClaseUno.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package PaqueteUno; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class ClaseUno { 13 | 14 | public int vPublica = 10; 15 | protected int vProtegida = 20; 16 | int vPaquete = 40; 17 | private int vPrivada = 30; 18 | 19 | public ClaseUno() { 20 | } 21 | 22 | public ClaseUno(int i) { 23 | 24 | System.out.println("Constructur Publico: " + i); 25 | } 26 | 27 | protected ClaseUno(int i, int j) { 28 | 29 | System.out.println("Constructur Protegido: "); 30 | 31 | } 32 | 33 | private ClaseUno(int i, int j, int k) { 34 | 35 | System.out.println("Constructur Privado: "); 36 | 37 | } 38 | 39 | ClaseUno(int i, int j, int k, int l) { 40 | 41 | System.out.println("Constructur Paquete: "); 42 | 43 | } 44 | 45 | public int desplegarPublico() { 46 | 47 | return 1; 48 | 49 | } 50 | 51 | protected int desplegarProtegido() { 52 | 53 | return 2; 54 | } 55 | 56 | private int desplegarPrivado() { 57 | 58 | return 3; 59 | 60 | } 61 | 62 | int desplegarPaquete() { 63 | 64 | return 4; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /20_ModificadoresAcceso/src/modificadoresacceso/ModificadoresAcceso.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package modificadoresacceso; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | 13 | import PaqueteDos.ClaseCuatro; 14 | import PaqueteDos.ClaseTres; 15 | import PaqueteUno.ClaseDos; 16 | 17 | public class ModificadoresAcceso { 18 | 19 | /** 20 | * @param args the command line arguments 21 | */ 22 | public static void main(String[] args) { 23 | // TODO code application logic here 24 | 25 | 26 | System.out.println("Acceso de clase 2 a clase 1 (mismo paquete)"); 27 | ClaseDos d=new ClaseDos(); 28 | d.desplegarClaseDos(); 29 | System.out.println("___________________________________________________________"); 30 | System.out.println("Acceso de clase 3 a clase 1(diferente paquete y herencia)"); 31 | ClaseTres d2=new ClaseTres(); 32 | d2.desplegarClaseTres(); 33 | System.out.println("___________________________________________________________"); 34 | System.out.println("Acceso de clase 4 a clase 1(diferente paquete, no herencia)"); 35 | 36 | ClaseCuatro d3=new ClaseCuatro(); 37 | d3.desplegarClaseCuatro(); 38 | System.out.println("___________________________________________________________"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /21_Sobreescritura/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /21_Sobreescritura/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=72f67093 2 | build.xml.script.CRC32=db359c33 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=72f67093 7 | nbproject/build-impl.xml.script.CRC32=ef92d7e9 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /21_Sobreescritura/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 21_Sobreescritura 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /21_Sobreescritura/src/pkg21_sobreescritura/Empleado.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg21_sobreescritura; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Empleado { 13 | 14 | protected String nombre; 15 | 16 | protected double sueldo; 17 | 18 | protected Empleado(String n, double s) { 19 | 20 | this.nombre = n; 21 | this.sueldo = s; 22 | 23 | } 24 | 25 | public String obtenerDetalles() { 26 | 27 | return "Nombre: " + nombre + "sueldo: " + sueldo; 28 | 29 | } 30 | 31 | public String getNombre() { 32 | 33 | return nombre; 34 | } 35 | 36 | public double getSueldo() { 37 | 38 | return sueldo; 39 | 40 | } 41 | 42 | public void setNombre(String n) { 43 | 44 | this.nombre = n; 45 | } 46 | 47 | public void setSueldo(double s) { 48 | 49 | this.sueldo = s; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /21_Sobreescritura/src/pkg21_sobreescritura/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg21_sobreescritura; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Main { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | Empleado e1=new Empleado("Pilar",15000); 21 | Medico m1= new Medico("Lizbeth",16000,"Cuidados intensivos"); 22 | /*Obtener detalles es un metodo que se sobreescribe, mismo nombre, mismo modificador o mas abierto y mismo tipo de retorno*/ 23 | System.out.println(e1.obtenerDetalles()); 24 | 25 | System.out.println(m1.obtenerDetalles()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /21_Sobreescritura/src/pkg21_sobreescritura/Medico.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg21_sobreescritura; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Medico extends Empleado { 13 | 14 | private String area; 15 | 16 | public Medico(String n, double s, String a) { 17 | super(n, s); 18 | this.area = a; 19 | } 20 | 21 | public String obtenerDetalles() { 22 | 23 | return "Nombre: " + nombre + "sueldo: " + sueldo + "Area: " + area; 24 | 25 | } 26 | 27 | public String getArea() { 28 | 29 | return area; 30 | } 31 | 32 | public void setArea(String a) { 33 | this.area = a; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /22_Polimorfismo/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /22_Polimorfismo/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1c0bdfe9 2 | build.xml.script.CRC32=6d8e704e 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=1c0bdfe9 7 | nbproject/build-impl.xml.script.CRC32=0656b370 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /22_Polimorfismo/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 22_Polimorfismo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /22_Polimorfismo/src/pkg22_polimorfismo/Empleado.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg22_polimorfismo; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Empleado { 13 | 14 | protected String nombre; 15 | protected double sueldo; 16 | 17 | protected Empleado(String nombre, double sueldo) { 18 | 19 | this.nombre = nombre; 20 | this.sueldo = sueldo; 21 | 22 | } 23 | 24 | public String obtenerDetalles() { 25 | return "Nombre" + nombre + "sueldo: " + sueldo; 26 | } 27 | 28 | public String getNombre() { 29 | 30 | return nombre; 31 | } 32 | 33 | public void setNombre(String nombre) { 34 | 35 | this.nombre = nombre; 36 | } 37 | 38 | public double getSueldo() { 39 | 40 | return sueldo; 41 | } 42 | 43 | public void setSueldo() { 44 | 45 | this.sueldo = sueldo; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /22_Polimorfismo/src/pkg22_polimorfismo/Gerente.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg22_polimorfismo; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Gerente extends Empleado { 13 | 14 | private String departamento; 15 | 16 | public Gerente(String nombre, double sueldo, String departamento) { 17 | 18 | super(nombre, sueldo); 19 | 20 | this.departamento = departamento; 21 | } 22 | //Aplicamos polimorfismo 23 | public String obtenerDetalles() { 24 | 25 | return super.obtenerDetalles() + "departamento :" + departamento; 26 | } 27 | 28 | public String getDepartamento() { 29 | 30 | return departamento; 31 | } 32 | 33 | public void setDepartamento(String departamento) { 34 | 35 | this.departamento = departamento; 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /22_Polimorfismo/src/pkg22_polimorfismo/Polimorfismo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg22_polimorfismo; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Polimorfismo { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | Empleado em=new Empleado("Luigi",3000); 21 | 22 | System.out.println("Resultado"+em.obtenerDetalles()); 23 | 24 | Gerente g=new Gerente("Mario",5000,"Tuberias"); 25 | 26 | System.out.println("Resultado"+g.obtenerDetalles()); 27 | 28 | 29 | desplegarDetalles(em); 30 | desplegarDetalles(g); 31 | 32 | } 33 | 34 | //Aplicamos polimorfismo 35 | public static void desplegarDetalles(Empleado emp){ 36 | 37 | System.out.println("Resultado"+emp.obtenerDetalles()); 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /23_ValidarInstancias/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /23_ValidarInstancias/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=283b05f1 2 | build.xml.script.CRC32=e64bdee7 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=283b05f1 7 | nbproject/build-impl.xml.script.CRC32=cf0c34bc 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /23_ValidarInstancias/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 23_ValidarInstancias 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /23_ValidarInstancias/src/pkg23_validarinstancias/Circulo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg23_validarinstancias; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Circulo extends FigurasGeometricas{ 13 | public void desplegar(){ 14 | 15 | System.out.println("Desplegando circulo"); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /23_ValidarInstancias/src/pkg23_validarinstancias/Elipse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg23_validarinstancias; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Elipse extends Circulo{ 13 | public void desplegar(){ 14 | 15 | System.out.println("Desplegando elipse"); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /23_ValidarInstancias/src/pkg23_validarinstancias/FigurasGeometricas.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg23_validarinstancias; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class FigurasGeometricas { 13 | 14 | 15 | public void desplegarFigura(){ 16 | 17 | System.out.println("Desplegando figuras geometricas"); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /23_ValidarInstancias/src/pkg23_validarinstancias/Instancias.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg23_validarinstancias; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Instancias { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | FigurasGeometricas fg; 21 | 22 | fg = new Elipse(); 23 | 24 | indicarTipo(fg); 25 | 26 | } 27 | 28 | public static void indicarTipo(FigurasGeometricas fg) { 29 | 30 | if (fg instanceof Triangulo) { 31 | System.out.println("Es un triangulo"); 32 | } 33 | if (fg instanceof Rectangulo) { 34 | System.out.println("Es un rectangulo"); 35 | } 36 | 37 | if(fg instanceof Circulo) 38 | System.out.println("Es un Circulo"); 39 | 40 | 41 | if(fg instanceof Elipse) 42 | System.out.println("Es una elipse"); 43 | 44 | if(fg instanceof FigurasGeometricas) 45 | System.out.println("Es una figura geometrica"); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /23_ValidarInstancias/src/pkg23_validarinstancias/Rectangulo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg23_validarinstancias; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Rectangulo extends FigurasGeometricas{ 13 | public void desplegar(){ 14 | 15 | System.out.println("Desplegando rectangulo"); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /23_ValidarInstancias/src/pkg23_validarinstancias/Triangulo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg23_validarinstancias; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Triangulo extends FigurasGeometricas{ 13 | public void desplegar(){ 14 | 15 | System.out.println("Desplegando triangulo"); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /24_Interfaces/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /24_Interfaces/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=cca458af 2 | build.xml.script.CRC32=84657309 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=cca458af 7 | nbproject/build-impl.xml.script.CRC32=b9a3431f 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /24_Interfaces/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 24_Interfaces 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /24_Interfaces/src/datos/AccesoDatos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package datos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public interface AccesoDatos { 13 | 14 | 15 | public static int MAX_REG=5; 16 | public abstract void insertar(); 17 | public abstract void listar(); 18 | } 19 | -------------------------------------------------------------------------------- /24_Interfaces/src/datos/ImplementacionMySQL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package datos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class ImplementacionMySQL implements AccesoDatos { 13 | @Override 14 | public void insertar(){ 15 | 16 | System.out.println("Insertando valores desde MySQL"); 17 | } 18 | 19 | @Override 20 | public void listar(){ 21 | System.out.println("Mostrando valores desde MySQL"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /24_Interfaces/src/datos/ImplementacionOracle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package datos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class ImplementacionOracle implements AccesoDatos { 13 | 14 | @Override 15 | public void insertar(){ 16 | 17 | System.out.println("Insertando valores desde Oracle"); 18 | } 19 | 20 | @Override 21 | public void listar(){ 22 | System.out.println("Mostrando valores desde Oracle"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /24_Interfaces/src/pkg24_interfaces/ManejoInterfaces.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg24_interfaces; 7 | 8 | import datos.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class ManejoInterfaces { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | AccesoDatos datos = new ImplementacionMySQL(); 23 | ejecutarDatos(datos, "listar"); 24 | 25 | AccesoDatos datos2=new ImplementacionOracle(); 26 | ejecutarDatos(datos2,"insertar"); 27 | 28 | } 29 | 30 | private static void ejecutarDatos(AccesoDatos d, String f) { 31 | 32 | if ("listar".equals(f)) { 33 | d.listar(); 34 | } else if ("insertar".equals(f)) { 35 | d.insertar(); 36 | } 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /25_Excepciones/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /25_Excepciones/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=d5eba840 2 | build.xml.script.CRC32=f96f32c1 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=d5eba840 7 | nbproject/build-impl.xml.script.CRC32=cc69e487 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /25_Excepciones/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 25_Excepciones 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /25_Excepciones/src/domain/Division.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package domain; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Division { 13 | 14 | private int numerador; 15 | private int denominador; 16 | 17 | public Division(int n,int d) throws OperationException{ 18 | 19 | //creando una excepcion personalizada 20 | if(d==0){ 21 | throw new OperationException("Denominador igual a cero"); 22 | } 23 | 24 | this.numerador=n; 25 | this.denominador=d; 26 | 27 | } 28 | 29 | public void visualizarOperacion(){ 30 | 31 | System.out.println("Resultado de la división "+numerador/denominador); 32 | 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /25_Excepciones/src/domain/OperationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package domain; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class OperationException extends Exception{ 13 | 14 | 15 | public OperationException(String msg){ 16 | 17 | super(msg); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /25_Excepciones/src/pkg25_excepciones/ManejoExcepciones.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg25_excepciones; 7 | 8 | import domain.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class ManejoExcepciones { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | try { 23 | Division d = new Division(5, 0); 24 | d.visualizarOperacion(); 25 | } 26 | catch(OperationException oe){ 27 | 28 | System.out.println("Hubo un error"); 29 | oe.printStackTrace(); 30 | 31 | } 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /25_Excepciones/src/pkg25_excepciones/ManejoExcepcionesArg.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg25_excepciones; 7 | import domain.*; 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class ManejoExcepcionesArg { 13 | 14 | public static void main(String args[]) throws OperationException{ 15 | 16 | try{ 17 | int op1=Integer.parseInt(args[0]); 18 | int op2=Integer.parseInt(args[2]); 19 | Division d=new Division(op1,op2); 20 | d.visualizarOperacion(); 21 | } 22 | catch(ArrayIndexOutOfBoundsException aie){ 23 | System.out.println("Ocurrio una excepción"); 24 | System.out.println("Hubo un error al acceder a un espacio fuera de rango"); 25 | aie.printStackTrace(); 26 | } 27 | catch(NumberFormatException nfe){ 28 | System.out.println("Hubo un error uno de los argumentos no es entero"); 29 | nfe.printStackTrace(); 30 | } 31 | catch(OperationException oe){ 32 | System.out.println("Hubo una excepción u operación erronea"); 33 | oe.printStackTrace(); 34 | }finally{ 35 | System.out.println("Se ejecutaron las excepciones"); 36 | ; 37 | } 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /26_ManejoColecciones/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /26_ManejoColecciones/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=8b69d1b2 2 | build.xml.script.CRC32=82321824 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=8b69d1b2 7 | nbproject/build-impl.xml.script.CRC32=449f497e 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /26_ManejoColecciones/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 26_ManejoColecciones 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /26_ManejoColecciones/src/pkg26_manejocolecciones/ManejoColecciones.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg26_manejocolecciones; 7 | 8 | import java.util.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class ManejoColecciones { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | List ML = new ArrayList(); 23 | ML.add("1"); 24 | ML.add("2"); 25 | ML.add("3"); 26 | ML.add("4"); 27 | ML.add("5"); 28 | ML.add("5");// tomara en cuenta apesar de ser repetido 29 | imprimir(ML); 30 | 31 | Set MS = new HashSet(); 32 | MS.add("00"); 33 | MS.add("01"); 34 | MS.add("02"); 35 | MS.add("02");// este elemento no lo tomara en cuenta por ser repetido 36 | MS.add("03"); 37 | MS.add("04"); 38 | 39 | 40 | MS.add("00"); // este elemento no lo tomara en cuenta por ser repetido 41 | 42 | imprimir(MS); 43 | 44 | Map MM = new HashMap(); 45 | MM.put("1", "Felipe"); 46 | MM.put("2", "Felip"); 47 | MM.put("3", "Jeli"); 48 | MM.put("3", "Feli");//se queda con el ultimo valor repetido 49 | MM.put("4", "Fel"); 50 | imprimir(MM.keySet()); 51 | imprimir(MM.values()); 52 | 53 | } 54 | 55 | private static void imprimir(Collection c) { 56 | 57 | for (Object elemento : c) { 58 | System.out.println(elemento + ""); 59 | } 60 | System.out.println("------------------------\n"); 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /27_ManejoGenericos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /27_ManejoGenericos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=b79ff1f8 2 | build.xml.script.CRC32=c09ba32d 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=b79ff1f8 7 | nbproject/build-impl.xml.script.CRC32=d0592fe0 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /27_ManejoGenericos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 27_ManejoGenericos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /27_ManejoGenericos/src/pkg27_manejogenericos/Generica.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg27_manejogenericos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Generica { 13 | 14 | T obj; 15 | 16 | public Generica(T o) { 17 | this.obj = o; 18 | } 19 | 20 | public void obtenerTipo() { 21 | 22 | System.out.println("El tipo de T es " + obj.getClass().getName()); 23 | System.out.println("El tipo de T es " + obj.getClass().getSimpleName()); 24 | System.out.println("El tipo de T es " + obj.getClass().getTypeName()); 25 | System.out.println("El tipo de T es " + obj.getClass().getCanonicalName()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /27_ManejoGenericos/src/pkg27_manejogenericos/ManejoGenericos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg27_manejogenericos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class ManejoGenericos { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | 20 | Generica ob=new Generica(10); 21 | ob.obtenerTipo(); 22 | 23 | Generica obs=new Generica<>("Buenos dias"); 24 | obs.obtenerTipo(); 25 | //marcara error si utilizamos int, double 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /28_ManejoCG/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /28_ManejoCG/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=47873a9e 2 | build.xml.script.CRC32=27c3e0b6 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=47873a9e 7 | nbproject/build-impl.xml.script.CRC32=0b117f63 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /28_ManejoCG/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/28_ManejoCG.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=pkg28_manejocg.ManejoCG 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /28_ManejoCG/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 28_ManejoCG 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /28_ManejoCG/src/pkg28_manejocg/ManejoCG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg28_manejocg; 7 | 8 | import java.util.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class ManejoCG { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | List LM = new ArrayList<>(); 23 | LM.add("1"); 24 | LM.add("1"); 25 | LM.add("1"); 26 | LM.add("2"); 27 | LM.add("3"); 28 | 29 | desplegar(LM); 30 | 31 | Set MS = new HashSet<>(); 32 | MS.add("1"); 33 | MS.add("10"); 34 | MS.add("10"); 35 | MS.add("100"); 36 | MS.add("1000"); 37 | 38 | desplegar(MS); 39 | 40 | Map MM = new HashMap<>(); 41 | 42 | MM.put("1", "P"); 43 | MM.put("2", "Pi"); 44 | MM.put("3", "Pil"); 45 | MM.put("4", "Pila"); 46 | desplegar(MM.keySet()); 47 | desplegar(MM.values()); 48 | 49 | } 50 | 51 | public static void desplegar(Collection c) { 52 | 53 | for (String elemento : c) { 54 | 55 | System.out.println("Elemento" + elemento); 56 | } 57 | 58 | System.out.println("-----------------------------"); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /29_EntradaDatos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /29_EntradaDatos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=ed911918 2 | build.xml.script.CRC32=163c09e7 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=ed911918 7 | nbproject/build-impl.xml.script.CRC32=9c7d37b0 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /29_EntradaDatos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 29_EntradaDatos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /29_EntradaDatos/src/pkg29_entradadatos/EntradaDatos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg29_entradadatos; 7 | 8 | import java.io.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class EntradaDatos { 15 | 16 | /** 17 | * @param args the command line arguments 18 | */ 19 | public static void main(String[] args) { 20 | // TODO code application logic here 21 | 22 | String c; 23 | InputStreamReader i= new InputStreamReader(System.in); 24 | //esto me permite leer lineas completas 25 | BufferedReader BRI=new BufferedReader(i); 26 | 27 | try{ 28 | System.out.println("Introduce un dato: "); 29 | c=BRI.readLine(); 30 | while(c!=null) 31 | { 32 | System.out.println("Dato introducido: "+c); 33 | c=BRI.readLine(); 34 | } 35 | } 36 | catch(IOException ioe){ 37 | 38 | System.out.println("Ocurrio un error, favor de corregirlo"); 39 | ioe.printStackTrace(); 40 | } 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /30_EntradaDatos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /30_EntradaDatos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=880e95df 2 | build.xml.script.CRC32=f7f04d74 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=880e95df 7 | nbproject/build-impl.xml.script.CRC32=eb3c86f7 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /30_EntradaDatos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 30_EntradaDatos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /30_EntradaDatos/src/pkg30_entradadatos/EntradaDatos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg30_entradadatos; 7 | 8 | import java.io.IOException; 9 | import java.util.*; 10 | 11 | /** 12 | * 13 | * @author Luis Monge 14 | */ 15 | public class EntradaDatos { 16 | 17 | /** 18 | * @param args the command line arguments 19 | */ 20 | public static void main(String[] args) { 21 | // TODO code application logic here 22 | 23 | String c; 24 | Scanner v = new Scanner(System.in); 25 | //Scanner no hereda de ninguna clase, funciona igual a InputStreamReader y BufferedStream 26 | System.out.println("Introduce un dato: "); 27 | c = v.nextLine(); 28 | while (c != null) { 29 | System.out.println("Dato introducido: " + c); 30 | c = v.nextLine(); 31 | } 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /31_Calculadora/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /31_Calculadora/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=c86536c5 2 | build.xml.script.CRC32=6941baf8 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=c86536c5 7 | nbproject/build-impl.xml.script.CRC32=ba3fd502 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /31_Calculadora/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 31_Calculadora 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /31_Calculadora/src/pkg31_calculadora/Calculadora.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg31_calculadora; 7 | 8 | import java.util.*; 9 | import java.io.*; 10 | 11 | 12 | /** 13 | * 14 | * @author Luis Monge 15 | */ 16 | public class Calculadora { 17 | 18 | /** 19 | * @param args the command line arguments 20 | */ 21 | public static void main(String[] args) { 22 | // TODO code application logic here 23 | int v,v2; 24 | Operaciones op=new Operaciones(); 25 | 26 | Scanner scan = new Scanner(System.in); 27 | 28 | System.out.println("Proporciona un valor"); 29 | v = scan.nextInt(); 30 | System.out.println("Proporciona un valor"); 31 | v2=scan.nextInt(); 32 | op.suma(v, v2); 33 | 34 | 35 | 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /31_Calculadora/src/pkg31_calculadora/Operaciones.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg31_calculadora; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Operaciones { 13 | 14 | private int op; 15 | private int op2; 16 | 17 | public Operaciones(){ 18 | 19 | } 20 | 21 | public Operaciones(int a, int b) { 22 | 23 | this.op = a; 24 | this.op2 = b; 25 | 26 | } 27 | 28 | public void suma(int a, int b) { 29 | 30 | int res=a+b; 31 | System.out.println("El resultado de la suma es: " + res); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /32_ManejoArchivos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /32_ManejoArchivos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=fec446cd 2 | build.xml.script.CRC32=bb404fe5 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=fec446cd 7 | nbproject/build-impl.xml.script.CRC32=cccb33be 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /32_ManejoArchivos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 32_ManejoArchivos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /32_ManejoArchivos/src/pkg32_manejoarchivos/ManejoArchivos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg32_manejoarchivos; 7 | import static utileria.Archivos.*; 8 | import java.io.*; 9 | /** 10 | * 11 | * @author Luis Monge 12 | */ 13 | public class ManejoArchivos { 14 | 15 | /** 16 | * @param args the command line arguments 17 | */ 18 | public static void main(String[] args) { 19 | // TODO code application logic here 20 | 21 | //creamos directorio 22 | Boolean crear; 23 | String PATH="C:\\Users\\Usuario\\Desktop\\prueba"; 24 | String NARCHIVO=PATH+"\\demo.txt"; 25 | crear = new File(PATH).mkdirs(); 26 | 27 | crearArchivo(NARCHIVO); 28 | escribirArchivo(NARCHIVO); 29 | leerArchivo(NARCHIVO); 30 | adjuntarArchivo(NARCHIVO); 31 | leerArchivo(NARCHIVO); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /32_ManejoArchivos/src/utileria/Archivos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package utileria; 7 | 8 | import java.io.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Archivos { 15 | 16 | public static void crearArchivo(String na) { 17 | 18 | File archivo = new File(na); 19 | 20 | try { 21 | PrintWriter salida = new PrintWriter(new FileWriter(archivo)); 22 | salida.close(); 23 | System.out.println("[CrearArchivo]El archivo se ha creado correctamente\n"); 24 | 25 | } catch (IOException ioe) { 26 | ioe.printStackTrace(); 27 | } 28 | 29 | } 30 | 31 | public static void escribirArchivo(String na) { 32 | 33 | File archivo = new File(na); 34 | 35 | try { 36 | PrintWriter salida = new PrintWriter(new FileWriter(archivo)); 37 | String insertar = "[EscribirArchivo]Esta informacion se almacena en el archivo\n"; 38 | salida.println(insertar); 39 | salida.println("--------\n"); 40 | salida.close(); 41 | } catch (IOException ioe) { 42 | 43 | ioe.printStackTrace(); 44 | 45 | } 46 | } 47 | 48 | public static void leerArchivo(String na) { 49 | String lee; 50 | File archivo = new File(na); 51 | try { 52 | BufferedReader leer = new BufferedReader(new FileReader(archivo)); 53 | lee = leer.readLine(); 54 | 55 | while (lee != null) { 56 | System.out.println("[LeerArchivo]contenido: " + lee+"\n"); 57 | lee = leer.readLine(); 58 | } 59 | leer.close(); 60 | } catch (IOException ioe) { 61 | ioe.printStackTrace(); 62 | 63 | } 64 | 65 | } 66 | 67 | public static void adjuntarArchivo(String na) { 68 | File archivo = new File(na); 69 | String insertar; 70 | try { 71 | PrintWriter salida = new PrintWriter(new FileWriter(archivo, true)); 72 | insertar = "[AdjuntarArchivo]Esta informacion se almacenra en el archivo\n"; 73 | salida.println(insertar); 74 | salida.println("--------\n"); 75 | salida.close(); 76 | 77 | } catch (IOException ioe) { 78 | 79 | ioe.printStackTrace(); 80 | } 81 | 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=aa44c93d 2 | build.xml.script.CRC32=ca8be3fa 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=aa44c93d 7 | nbproject/build-impl.xml.script.CRC32=3f473783 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 33_ManejoMultimedia 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/datos/AccesoDatos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.datos; 7 | 8 | import java.util.List; 9 | import IamLAM.com.peliculas.domain.*; 10 | import IamLAM.com.peliculas.excepciones.*; 11 | 12 | /** 13 | * 14 | * @author Luis Monge 15 | */ 16 | public interface AccesoDatos { 17 | 18 | boolean existe(String nombreArchivo) throws AccesoDatosEx; 19 | 20 | public List listar(String nombreArchivo) throws LecturaDatosEx; 21 | 22 | void escribir(Pelicula pelicula, String nombreArchivo, boolean anexar) throws EscrituraDatosEx; 23 | 24 | public String buscar(String nombreArchivo, String buscar) throws LecturaDatosEx; 25 | 26 | public void crear(String nombreArchivo) throws AccesoDatosEx; 27 | 28 | public void borrar(String nombreArchivo) throws AccesoDatosEx; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/domain/Pelicula.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.domain; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Pelicula { 13 | 14 | String nombre; 15 | 16 | public Pelicula(String n) { 17 | 18 | this.nombre = n; 19 | 20 | } 21 | 22 | public void setNombre(String n) { 23 | 24 | this.nombre = n; 25 | 26 | } 27 | 28 | public String getNombre() { 29 | 30 | return this.nombre; 31 | 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return this.nombre; 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/excepciones/AccesoDatosEx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.excepciones; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class AccesoDatosEx extends Exception { 13 | 14 | String mensaje; 15 | 16 | public AccesoDatosEx(String mensaje){ 17 | 18 | this.mensaje=mensaje; 19 | } 20 | 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/excepciones/EscrituraDatosEx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.excepciones; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class EscrituraDatosEx extends AccesoDatosEx { 13 | 14 | public EscrituraDatosEx(String mensaje) { 15 | 16 | super(mensaje); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/excepciones/LecturaDatosEx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.excepciones; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class LecturaDatosEx extends AccesoDatosEx { 13 | 14 | public LecturaDatosEx(String mensaje) { 15 | 16 | super(mensaje); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/negocio/CatalogoPeliculas.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.negocio; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public interface CatalogoPeliculas { 13 | 14 | public void agregarPelicula(String nombrePelicula, String nombreArchivo); 15 | 16 | public void listarPeliculas(String nombreArchivo); 17 | 18 | public void buscarPelicula(String nombreArchivo, String buscar); 19 | 20 | public void iniciarArchivo(String nombreArchivo); 21 | } 22 | -------------------------------------------------------------------------------- /33_ManejoMultimedia/src/IamLAM/com/peliculas/negocio/CatalogoPeliculasImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package IamLAM.com.peliculas.negocio; 7 | import java.util.List; 8 | import IamLAM.com.peliculas.datos.*; 9 | import IamLAM.com.peliculas.domain.*; 10 | import IamLAM.com.peliculas.excepciones.*; 11 | /** 12 | * 13 | * @author Luis Monge 14 | */ 15 | public class CatalogoPeliculasImpl { 16 | private final AccesoDatos datos; 17 | 18 | public CatalogoPeliculasImpl() { 19 | this.datos = new AccesoDatosImpl(); 20 | } 21 | 22 | public void agregarPelicula(String nombrePelicula, String nombreArchivo) { 23 | Pelicula pelicula = new Pelicula(nombrePelicula); 24 | boolean anexar = false; 25 | try { 26 | anexar = datos.existe(nombreArchivo); 27 | datos.escribir(pelicula, nombreArchivo, anexar); 28 | } catch (AccesoDatosEx ex) { 29 | System.out.println("Error de acceso a datos"); 30 | ex.printStackTrace(); 31 | } 32 | } 33 | 34 | public void listarPeliculas(String nombreArchivo) { 35 | try { 36 | List peliculas = datos.listar(nombreArchivo); 37 | for (Pelicula pelicula : peliculas) { 38 | System.out.println("Pelicula:" + pelicula); 39 | } 40 | } catch (AccesoDatosEx ex) { 41 | System.out.println("Error de acceso a datos"); 42 | ex.printStackTrace(); 43 | } 44 | } 45 | 46 | public void buscarPelicula(String nombreArchivo, String buscar) { 47 | String resultado = null; 48 | try { 49 | resultado = datos.buscar(buscar, nombreArchivo); 50 | } catch (LecturaDatosEx ex) { 51 | System.out.println("Error al buscar la pelicula"); 52 | ex.printStackTrace(); 53 | } 54 | System.out.println("Resultado busqueda:" + resultado); 55 | } 56 | 57 | public void iniciarArchivo(String nombreArchivo) { 58 | try { 59 | if (datos.existe(nombreArchivo)) { 60 | datos.borrar(nombreArchivo); 61 | datos.crear(nombreArchivo); 62 | } else { 63 | //creamos archivo 64 | datos.crear(nombreArchivo); 65 | } 66 | } catch (AccesoDatosEx ex) { 67 | System.out.println("Error de acceso a datos"); 68 | ex.printStackTrace(); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /34_JDBCConexión/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /34_JDBCConexión/mysql-driver.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLAM/Java/0c5ac1494430b9ad1cff150bcbc58e2e490daa64/34_JDBCConexión/mysql-driver.jar -------------------------------------------------------------------------------- /34_JDBCConexión/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=4a96106b 2 | build.xml.script.CRC32=4179ae85 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=4a96106b 7 | nbproject/build-impl.xml.script.CRC32=00c13e3e 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /34_JDBCConexión/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 34_JDBCConexión 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /34_JDBCConexión/src/pkg34_jdbcconexión/JDBCConexion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg34_jdbcconexión; 7 | 8 | import java.sql.*; 9 | import java.util.logging.Level; 10 | import java.util.logging.Logger; 11 | 12 | /** 13 | * 14 | * @author Luis Monge 15 | */ 16 | public class JDBCConexion { 17 | 18 | /** 19 | * @param args the command line arguments 20 | */ 21 | public static void main(String[] args) { 22 | // TODO code application logic here 23 | 24 | //realizamos conexion mediante el controlador 25 | String ruta = "jdbc:mysql://localhost:3306/bancos?useSSL=false"; 26 | try { 27 | Class.forName("com.mysql.jdbc.Driver"); // validamos si existe en cache (solo versiones anteriores:opcional) 28 | Connection conexion = (Connection) DriverManager.getConnection(ruta, "root", ""); 29 | 30 | Statement instruccion = conexion.createStatement(); 31 | 32 | String sql = "SELECT * FROM cliente"; 33 | ResultSet result = instruccion.executeQuery(sql); 34 | while (result.next()) { 35 | System.out.print("Nombre:" + result.getString(1)); 36 | System.out.print(" Direccion:" + result.getString(2)); 37 | System.out.println(" Ciudad:" + result.getString(3)); 38 | } 39 | 40 | result.close(); 41 | instruccion.close(); 42 | conexion.close(); 43 | } catch (ClassNotFoundException | SQLException e) { 44 | e.printStackTrace(); 45 | } 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /35_ManejoPersonal/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /35_ManejoPersonal/mysql-driver.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLAM/Java/0c5ac1494430b9ad1cff150bcbc58e2e490daa64/35_ManejoPersonal/mysql-driver.jar -------------------------------------------------------------------------------- /35_ManejoPersonal/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=58e860b9 2 | build.xml.script.CRC32=0b69b7eb 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=58e860b9 7 | nbproject/build-impl.xml.script.CRC32=22c4f191 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /35_ManejoPersonal/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 35_ManejoPersonal 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /35_ManejoPersonal/src/datos/Conexion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package datos; 7 | 8 | import java.sql.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Conexion { 15 | 16 | private static String JDBC_DRIVER = "com.mysql.jdbc.Driver"; 17 | private static String JDBC_URL = "jdbc:mysql://localhost:3306/escuela?useSSL=false"; 18 | 19 | private static String JDBC_USER = "root"; 20 | private static String JDBC_PASS = ""; 21 | private static Driver driver = null; 22 | 23 | public static synchronized Connection getConnection() throws SQLException { 24 | /*Para trabajar con un hilo a la vez*/ 25 | if (driver == null) { 26 | 27 | try { 28 | 29 | Class jdbcDriverClass = Class.forName(JDBC_DRIVER); 30 | driver = (Driver) jdbcDriverClass.newInstance(); 31 | DriverManager.registerDriver(driver); 32 | } catch (Exception e) { 33 | System.out.println("Fallo la carga del driver JDBC"); 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | return DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASS); 39 | } 40 | 41 | public static void close(ResultSet rs) { 42 | 43 | try { 44 | if (rs != null) { 45 | rs.close(); 46 | } 47 | } catch (SQLException sqle) { 48 | sqle.printStackTrace(); 49 | } 50 | 51 | } 52 | 53 | public static void close(PreparedStatement ps) { 54 | 55 | try { 56 | if (ps != null) { 57 | ps.close(); 58 | } 59 | } catch (SQLException sqle) { 60 | sqle.printStackTrace(); 61 | } 62 | 63 | } 64 | 65 | public static void close(Connection con) { 66 | 67 | try { 68 | if (con != null) { 69 | con.close(); 70 | } 71 | } catch (SQLException sqle) { 72 | sqle.printStackTrace(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /35_ManejoPersonal/src/domain/Trabajador.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package domain; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Trabajador { 13 | 14 | private int id_trabajador; 15 | private String nombre; 16 | private String apellido; 17 | 18 | 19 | public int getIdTrabajador(){ 20 | 21 | return this.id_trabajador; 22 | 23 | } 24 | 25 | public String getNombre(){ 26 | return this.nombre; 27 | } 28 | 29 | public String getApellido(){ 30 | 31 | return this.apellido; 32 | } 33 | 34 | 35 | public void setIdTrabajador(int id){ 36 | 37 | this.id_trabajador=id; 38 | 39 | } 40 | 41 | 42 | public void setNombre(String n){ 43 | this.nombre=n; 44 | } 45 | 46 | public void setApellido(String a){ 47 | 48 | this.apellido=a; 49 | } 50 | 51 | 52 | @Override 53 | public String toString(){ 54 | 55 | return "[Trabajador]="+id_trabajador+"/"+nombre+"/"+apellido; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /35_ManejoPersonal/src/pkg35_manejopersonal/ManejoPersonal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg35_manejopersonal; 7 | import datos.TrabajadorJDBC; 8 | import domain.Trabajador; 9 | import java.util.List; 10 | 11 | /** 12 | * 13 | * @author Luis Monge 14 | */ 15 | public class ManejoPersonal { 16 | 17 | /** 18 | * @param args the command line arguments 19 | */ 20 | public static void main(String[] args) { 21 | // TODO code application logic here 22 | 23 | TrabajadorJDBC trabajador=new TrabajadorJDBC(); 24 | trabajador.insert("Pilar","Sanchez","Tabasco"); 25 | 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /36_ManejoTransacciones/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /36_ManejoTransacciones/mysql-driver.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLAM/Java/0c5ac1494430b9ad1cff150bcbc58e2e490daa64/36_ManejoTransacciones/mysql-driver.jar -------------------------------------------------------------------------------- /36_ManejoTransacciones/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=58e860b9 2 | build.xml.script.CRC32=0b69b7eb 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=58e860b9 7 | nbproject/build-impl.xml.script.CRC32=22c4f191 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /36_ManejoTransacciones/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | 35_ManejoPersonal 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /36_ManejoTransacciones/src/datos/Conexion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package datos; 7 | 8 | import java.sql.*; 9 | 10 | /** 11 | * 12 | * @author Luis Monge 13 | */ 14 | public class Conexion { 15 | 16 | private static String JDBC_DRIVER = "com.mysql.jdbc.Driver"; 17 | private static String JDBC_URL = "jdbc:mysql://localhost:3306/escuela?useSSL=false"; 18 | 19 | private static String JDBC_USER = "root"; 20 | private static String JDBC_PASS = ""; 21 | private static Driver driver = null; 22 | 23 | public static synchronized Connection getConnection() throws SQLException { 24 | /*Para trabajar con un hilo a la vez*/ 25 | if (driver == null) { 26 | 27 | try { 28 | 29 | Class jdbcDriverClass = Class.forName(JDBC_DRIVER); 30 | driver = (Driver) jdbcDriverClass.newInstance(); 31 | DriverManager.registerDriver(driver); 32 | } catch (Exception e) { 33 | System.out.println("Fallo la carga del driver JDBC"); 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | return DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASS); 39 | } 40 | 41 | public static void close(ResultSet rs) { 42 | 43 | try { 44 | if (rs != null) { 45 | rs.close(); 46 | } 47 | } catch (SQLException sqle) { 48 | sqle.printStackTrace(); 49 | } 50 | 51 | } 52 | 53 | public static void close(PreparedStatement ps) { 54 | 55 | try { 56 | if (ps != null) { 57 | ps.close(); 58 | } 59 | } catch (SQLException sqle) { 60 | sqle.printStackTrace(); 61 | } 62 | 63 | } 64 | 65 | public static void close(Connection con) { 66 | 67 | try { 68 | if (con != null) { 69 | con.close(); 70 | } 71 | } catch (SQLException sqle) { 72 | sqle.printStackTrace(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /36_ManejoTransacciones/src/domain/Trabajador.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package domain; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Trabajador { 13 | 14 | private int id_trabajador; 15 | private String nombre; 16 | private String apellido; 17 | 18 | 19 | public int getIdTrabajador(){ 20 | 21 | return this.id_trabajador; 22 | 23 | } 24 | 25 | public String getNombre(){ 26 | return this.nombre; 27 | } 28 | 29 | public String getApellido(){ 30 | 31 | return this.apellido; 32 | } 33 | 34 | 35 | public void setIdTrabajador(int id){ 36 | 37 | this.id_trabajador=id; 38 | 39 | } 40 | 41 | 42 | public void setNombre(String n){ 43 | this.nombre=n; 44 | } 45 | 46 | public void setApellido(String a){ 47 | 48 | this.apellido=a; 49 | } 50 | 51 | 52 | @Override 53 | public String toString(){ 54 | 55 | return "[Trabajador]="+id_trabajador+"/"+nombre+"/"+apellido; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /36_ManejoTransacciones/src/pkg35_manejopersonal/ManejoPersonal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package pkg35_manejopersonal; 7 | import datos.TrabajadorJDBC; 8 | import domain.Trabajador; 9 | import java.util.List; 10 | 11 | /** 12 | * 13 | * @author Luis Monge 14 | */ 15 | public class ManejoPersonal { 16 | 17 | /** 18 | * @param args the command line arguments 19 | */ 20 | public static void main(String[] args) { 21 | // TODO code application logic here 22 | 23 | TrabajadorJDBC trabajador=new TrabajadorJDBC(); 24 | trabajador.insert("Pilar","Sanchez","Tabasco"); 25 | 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Aprendiendo programación con JAVA :sunglasses: :coffee: 2 | 3 | _Profesor: Luis Angel Monge_ 4 | profesor@luismonge.com.mx 5 | 6 | ## Descripción 7 | 8 | _Este es un curso de programación en JAVA,que contempla desde aspectos básicos como la declaración de variables hasta el manejo de transacciones _ 9 | 10 | ### Pre-requisitos :white_check_mark: 11 | 12 | * [Netbeans](https://netbeans.org/) - Software a utilizar 13 | 14 | 15 | ### Temario :rocket: 16 | 1. Variables 17 | 2. Operadores lógicos, aritméticos y relacionales 18 | 3. Secuencias de Control 19 | 4. Ciclos 20 | 5. Manejo de clases 21 | 6. Como utilizar los constructores 22 | 7. Encapsulamiento 23 | 8. Herencia 24 | 9. Sobrecarga de métodos 25 | 10. Manejo de paquetes 26 | 11. Manejo de arreglos 27 | 12. Manejo de matrices 28 | 13. Modificadores de acceso [publicos, privados, protegidos] 29 | 14. Polimorfismo 30 | 15. Excepciones 31 | 16. Manejo de colecciones y genéricos 32 | 17. Manejo de archivos 33 | 18. Manejo de multimedia 34 | 19. Conexiones a bases de datos JDBC 35 | 36 | -------------------------------------------------------------------------------- /Saludos/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Saludos/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=cf5bb942 2 | build.xml.script.CRC32=671f32ce 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=cf5bb942 7 | nbproject/build-impl.xml.script.CRC32=11512fb7 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /Saludos/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/Saludos.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=saludos.Saludos 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /Saludos/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | Saludos 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Saludos/src/saludos/Saludos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package saludos; 7 | 8 | /** 9 | * 10 | * @author Luis Monge 11 | */ 12 | public class Saludos { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | public static void main(String[] args) { 18 | // TODO code application logic here 19 | System.out.println("Bienvenido al curso de Java"); 20 | } 21 | 22 | } 23 | --------------------------------------------------------------------------------