diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23a0b0a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/JavaApplication1/nbproject/private/ \ No newline at end of file diff --git a/JavaApplication1/build.xml b/JavaApplication1/build.xml new file mode 100644 index 0000000..9a33201 --- /dev/null +++ b/JavaApplication1/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project JavaApplication1. + + + diff --git a/JavaApplication1/manifest.mf b/JavaApplication1/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/JavaApplication1/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/JavaApplication1/nbproject/build-impl.xml b/JavaApplication1/nbproject/build-impl.xml new file mode 100644 index 0000000..c158f28 --- /dev/null +++ b/JavaApplication1/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JavaApplication1/nbproject/genfiles.properties b/JavaApplication1/nbproject/genfiles.properties new file mode 100644 index 0000000..f6e6d1e --- /dev/null +++ b/JavaApplication1/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=3569ad16 +build.xml.script.CRC32=360ae6d5 +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=3569ad16 +nbproject/build-impl.xml.script.CRC32=3e9f3573 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/JavaApplication1/nbproject/project.properties b/JavaApplication1/nbproject/project.properties new file mode 100644 index 0000000..a16b614 --- /dev/null +++ b/JavaApplication1/nbproject/project.properties @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/JavaApplication1.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=javaapplication1.JavaApplication1 +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/JavaApplication1/nbproject/project.xml b/JavaApplication1/nbproject/project.xml new file mode 100644 index 0000000..b466dd5 --- /dev/null +++ b/JavaApplication1/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + JavaApplication1 + + + + + + + + + diff --git a/JavaApplication1/src/javaapplication1/Cuenta.java b/JavaApplication1/src/javaapplication1/Cuenta.java new file mode 100644 index 0000000..d6dd127 --- /dev/null +++ b/JavaApplication1/src/javaapplication1/Cuenta.java @@ -0,0 +1,71 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaapplication1; + +/** + * + * @author Jorge + */ +public class Cuenta { + + private String titular; + private Double cantidad; + + + public Cuenta(String getTitular) { + this.titular = getTitular; + this.cantidad = 0.00; + } + + public Cuenta(String getTitular, Double getCant) { + this.titular = getTitular; + if(getCant < 0){ + this.cantidad = 0.00; + }else{ + this.cantidad = getCant; + } + } + + public String getTitular() { + return titular; + } + + public void setTitular(String tit) { + this.titular = tit; + } + + public String toStringTitular() { + return "Accede o setea el nombre del titular de la cuenta"; + } + + public Double getCantidad() { + return cantidad; + } + + public void setCantidad(Double cant) { + this.cantidad = cant; + } + + public String toStringCantidad() { + return "Accede o setea la cantidad de dinero de la cuenta"; + } + + public void ingresar(Double cant) { + if(cant > 0){ + this.cantidad += cant; + } + } + + public void retirar(Double cant) { + + this.cantidad -= cant; + + if(this.cantidad < 0){ + this.cantidad = 0.00; + } + } + +} diff --git a/JavaApplication1/src/javaapplication1/JavaApplication1.java b/JavaApplication1/src/javaapplication1/JavaApplication1.java new file mode 100644 index 0000000..818f9db --- /dev/null +++ b/JavaApplication1/src/javaapplication1/JavaApplication1.java @@ -0,0 +1,30 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaapplication1; +/** + * + * @author Jorge + */ +public class JavaApplication1 { + + public Cuenta cuenta; + public Cuenta cuenta2; + + public void main(String[] args) { + // TODO code application logic here + + cuenta = new Cuenta("Jorge Lopez"); + cuenta2 = new Cuenta("Jorge Lopez", 235.10); + + cuenta.setCantidad(500.30); + + cuenta.ingresar(35.27); + + cuenta2.retirar(314.00); + + } + +} diff --git a/JavaApplication1/src/javaapplication1/JavaApplication2.java b/JavaApplication1/src/javaapplication1/JavaApplication2.java new file mode 100644 index 0000000..dd90222 --- /dev/null +++ b/JavaApplication1/src/javaapplication1/JavaApplication2.java @@ -0,0 +1,32 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaapplication1; + +/** + * + * @author Jorge + */ +public class JavaApplication2 { + + public Persona personaObj1; + public Persona personaObj2; + public Persona personaObj3; + + public void main(String[] args) { + // TODO code application logic here + + String nombre = "Jorge"; + Integer edad = 27; + char sexo = 'H'; + Double peso = 56.5; + Double altura = 1.67; + + + + + } + +} diff --git a/JavaApplication1/src/javaapplication1/Persona.java b/JavaApplication1/src/javaapplication1/Persona.java new file mode 100644 index 0000000..bb9630d --- /dev/null +++ b/JavaApplication1/src/javaapplication1/Persona.java @@ -0,0 +1,123 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaapplication1; + +import java.util.Random; + +/** + * + * @author Jorge + */ +public class Persona { + + private String nombre; + private Integer edad; + private String dni; + private char sexo; + private Double peso; + private Double altura; + static final char[] LETTERS = {'T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X','B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E'}; + + public Persona() { + this.nombre = ""; + this.edad = 0; + this.dni = ""; + this.sexo = 'M'; + this.peso = 0.00; + this.altura = 0.00; + } + + public Persona(String nombre, Integer edad, char sexo) { + this.nombre = nombre; + this.edad = edad; + this.dni = ""; + this.sexo = sexo; + this.peso = 0.00; + this.altura = 0.00; + } + + public Persona(String nombre, Integer edad, String dni, char sexo, Double peso, Double altura) { + this.nombre = nombre; + this.edad = edad; + this.dni = dni; + this.sexo = sexo; + this.peso = peso; + this.altura = altura; + } + + public Integer calcularIMC(Double peso, Double altura) { + Double total = peso / (altura * altura); + if (total > 25) { + return 1; + } else if (total >= 20) { + return 0; + } else { + return -1; + } + } + + public Boolean esMayorDeEdad(Integer edad) { + if (edad >= 18) { + return true; + } else { + return false; + } + } + + private char comprobarSexo(char sexo) { + if (sexo != 'M' || sexo != 'H') { + return 'H'; + } else { + return sexo; + } + } + + public String toString() { + return "Nombre: el nombre de la persona" + + "Edad: la edad de la persona" + + "Dni: el número de identificación de la persona" + + "Sexo: Hombre(H) o Mujer(M) , (por defecto Hombre)" + + "peso: peso en kg" + + "altura: estatura en metros"; + } + + public String generaDNI() { + Integer numeros = randomNumber(); + String dni = addLetter(numeros); + return dni; + } + + public Integer randomNumber() { + + int r = (int) (Math.random() * (99999999 - 100000000)) + 100000000; + return r; + + } + + public String addLetter(Integer numeros){ + int resto = numeros % 23; + char letra = LETTERS[resto]; + String dni = Integer.toString(resto) + Character.toString(letra); + return dni; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + public void setEdad(Integer edad) { + this.edad = edad; + } + public void setSexo(char sexo) { + this.sexo = sexo; + } + public void setPeso(Double peso) { + this.peso = peso; + } + public void setAltura(Double altura) { + this.altura = altura; + } + +}