From 5eedda2739818d104839a850f64ec82a13a9cd10 Mon Sep 17 00:00:00 2001 From: KyMAN <0kyman0@gmail.com> Date: Tue, 5 Mar 2024 01:15:52 +0100 Subject: [PATCH] feat: Ejercicio de repaso creado. --- README.md | 49 +- build.xml | 73 + build/built-jar.properties | 4 + build/classes/.netbeans_automatic_build | 0 build/classes/.netbeans_update_resources | 0 .../repasopoocoches/Abstracciones/Coche.class | Bin 0 -> 1906 bytes .../repasopoocoches/Interfaces/Coches.class | Bin 0 -> 181 bytes .../classes/repasopoocoches/Marcas/Ford.class | Bin 0 -> 1015 bytes .../repasopoocoches/Marcas/Peugeut.class | Bin 0 -> 1027 bytes .../repasopoocoches/Marcas/Renault.class | Bin 0 -> 1027 bytes .../repasopoocoches/Marcas/Toyota.class | Bin 0 -> 1023 bytes .../repasopoocoches/RepasoPOOCoches.class | Bin 0 -> 2928 bytes dist/README.TXT | 32 + dist/RepasoPOOCoches.jar | Bin 0 -> 11379 bytes manifest.mf | 3 + nbproject/build-impl.xml | 1771 +++++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/private/private.properties | 2 + nbproject/private/private.xml | 7 + nbproject/project.properties | 95 + nbproject/project.xml | 15 + src/repasopoocoches/Abstracciones/Coche.java | 55 + src/repasopoocoches/Interfaces/Coches.java | 19 + src/repasopoocoches/Marcas/Ford.java | 45 + src/repasopoocoches/Marcas/Peugeut.java | 45 + src/repasopoocoches/Marcas/Renault.java | 45 + src/repasopoocoches/Marcas/Toyota.java | 45 + src/repasopoocoches/RepasoPOOCoches.java | 57 + 28 files changed, 2369 insertions(+), 1 deletion(-) create mode 100644 build.xml create mode 100644 build/built-jar.properties create mode 100644 build/classes/.netbeans_automatic_build create mode 100644 build/classes/.netbeans_update_resources create mode 100644 build/classes/repasopoocoches/Abstracciones/Coche.class create mode 100644 build/classes/repasopoocoches/Interfaces/Coches.class create mode 100644 build/classes/repasopoocoches/Marcas/Ford.class create mode 100644 build/classes/repasopoocoches/Marcas/Peugeut.class create mode 100644 build/classes/repasopoocoches/Marcas/Renault.class create mode 100644 build/classes/repasopoocoches/Marcas/Toyota.class create mode 100644 build/classes/repasopoocoches/RepasoPOOCoches.class create mode 100644 dist/README.TXT create mode 100644 dist/RepasoPOOCoches.jar create mode 100644 manifest.mf create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/private/private.properties create mode 100644 nbproject/private/private.xml create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/repasopoocoches/Abstracciones/Coche.java create mode 100644 src/repasopoocoches/Interfaces/Coches.java create mode 100644 src/repasopoocoches/Marcas/Ford.java create mode 100644 src/repasopoocoches/Marcas/Peugeut.java create mode 100644 src/repasopoocoches/Marcas/Renault.java create mode 100644 src/repasopoocoches/Marcas/Toyota.java create mode 100644 src/repasopoocoches/RepasoPOOCoches.java diff --git a/README.md b/README.md index 5b81d4d..878f65b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,50 @@ # RepasoPOOCoches -Ejercicio de repaso que hay en el raíz del contenido de la asignatura de Procesos y Serivicos. \ No newline at end of file +> Este ejercicio fue hecho sin mirar el temario y entregado fuera de plazo por motivos agenos al ciclo, por lo que independientemente de resultados, agradecer al profesor a cargo de la asignatura por mirarlo igualmente pese a dichas condiciones, así por el apoyo ofrecido. También quiero que quede de aviso para otros posibles compañeros que quieran hacer uso de este contenido por posiblemente no ceñirse a lo requerido en la asignatura. Sea como sea, espero sea útil para aprender y reciclarse como lo fue para mi. + +Este es un ejercicio de repaso que hay dentro de la asignatura de Programación de Servicios y Procesos. La idea es conseguir gestionar diferentes tipos de coches a partir de clases heredadas y repasar el ámbito de los atributos y elementos de clase y objeto. + +A modo de estructuración del proyecto tenemos 3 directorios a modo de paquetes para: + +- **Interfaces**: Aquí irán las interfaces asignadas al ejercicio. +- **Abstracciones**: Aquí irán las abstracciones (Clases abstractas) asignadas al ejercicio. +- **Marcas**: Paquete hecho a modo de modelos de cada una de las marcas que se vayan a trabajar aquí. + +> El ejercicio en sí no me tenía mucha lógica funcional, así que lo fui adaptando para poder alcanzar un fin funcional en cuestión. Uno de los grandes problemas que encontré esla sobreescritura de los métodos de control del vehículo, que teóricamente han de ser iguales para todos y lo que varían en sí serían los parámetros que usen. Para poder hacer un "Override" de éstos, expuse una interfaz de la cual partan obligatoriamente dichos métodos. Para que los métodos sean distintos entre las distintas marcas, se establece un valor numérico personalizado según la marca. + +La abstracción **Coche** implementa de forma heredada la interfaz **Coches** para que al definir cada marca, ésta tenga la obligación de crear dicho método. También tiene ciertos parámetros comunes a todos los coches, los cuales han de ser sobreescritos por cada Marca implementada. + +> Para que todo esto tenga sentido, el constructor de cada marca operará en base al rendimiento del coche: un valor porcentual en base decimal, es decir, 1 sería el 100%, que determinará el rendimiento, velocidad máxima y capacidad del tanque de combustible, a mayores de la customización implementada en cada marca. + +Finalmente, se implementaron las marcas: + +- **Ford** +- **Peugeut** +- **Renault** +- **Toyota** + +```mermaid +flowchart TD + +I["Coches (Interfaz)"] +A["Coche (Abstracta)"] +F[Ford] +P[Peugeut] +R[Renault] +T[Toyota] + +I --> A +A --> F +A --> P +A --> R +A --> T + +``` + +La Interfaz **Coches** obligará a construir los métodos: + +- **acelerar** +- **frenar**: Se entenderá como una aceleración negativa. +- **repostar** + +En la clase principal **RepasoPOOCoches** se montarán todos los vehículos que se quieran en base al parámetro de configuración allí existente, que depende de los propios Coches existentes en Marcas como clases-objeto, en una tabla de datos la cual será migrada en el *main* a un ArrayList el cual luego ordenará mediante **sort** y un *Arrow Function* (Equivalente a crear un objeto *Comparator* y el Override de *compare*) donde se hará una comparativa mediante un valor numérico que determina si es mayor o menor que el objeto anterior, comparando, en este caso, mediante casteo a *Coche*, las potencias de todos los coches creados. Tras ésto, ejecutará cada uno de los métodos de la Interfaz e imprimirá, mediante el método *toString*, de forma automática, los datos del vehículo para determinar tanto su orden como el correcto funcionamiento de todo. \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..229be97 --- /dev/null +++ b/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project RepasoPOOCoches. + + + diff --git a/build/built-jar.properties b/build/built-jar.properties new file mode 100644 index 0000000..da9b78e --- /dev/null +++ b/build/built-jar.properties @@ -0,0 +1,4 @@ +#Tue, 05 Mar 2024 01:15:20 +0100 + + +/home/DAM2024/RepasoPOOCoches= diff --git a/build/classes/.netbeans_automatic_build b/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/build/classes/.netbeans_update_resources b/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/build/classes/repasopoocoches/Abstracciones/Coche.class b/build/classes/repasopoocoches/Abstracciones/Coche.class new file mode 100644 index 0000000000000000000000000000000000000000..68fe490530022e5f64f992767019d6bc90d9cebf GIT binary patch literal 1906 zcmaJ?TW=dh6#m9>V#nT+)NONXE}O(@64S(73JthzXq}o?N-0u85bzL<*OO+G-5s;L zj_6s;DI*qYm!Z_fG7Idf+Jefj)v0IRrHKn6WI zWG(cfPhfCQ9>}UEgGbee%{}GB0)02!z>RMS^eilH<&hUCuBph;fp*-M?neQ|94rgx z@P@!_sM<2pZLJ;c?5e1GyBWoybR1U)T-A+Gpx2k7BLzz9$L2QT&N(n7Cl!A}$H!+d5W(MKqLvtmXVHGxNM|@N78Lye&hPmY))91 zG@C_7`^`=iyG>6Sxou(E$S*pwEfZDSG`}6o;OmYmF%fum=We{q zSwv7A3EW&b?a^sT!~7Oc%X63)n0`Hi_k&o4JJLA}AI)Uz42;0Qx*MoZI(}1yo03kL zfNDp2TQYRbx+~1ayDksSt-r4MjNH`dzGB`xu?)9q(^E_yb4QyCjm0e{pc9xND=I9w zffFiU1+f-5w-HNc|AB0Gjh^=vX>XqhajK$06%K=ClyDmBH19OKa7ILEWJ7mCM>SmI zULmtMLbGT(PwJK0PzF%%|p!ZcZHJ2u@A)Q!< zj|ILznYJ!4ReDbbEl)+|b*=Y1?b_*_oshh8aPx6nodN&q1U@aW+DW&&D(cenHr!a% z^0+PVXX3T3B3pTOS`zlWn73QX_N1MZQnF@A+QLX3*`xv;nfYP8EEno-=yZ5M+MPh! zM}=WPV&AXszA`!9_W$|W6wY#C(^UbXUSi?6a?G+5*eOgWN^H-KLme#(SoecKg>_Fx zk&1Fy<1IXuk+TAw1MkV?|3mpcq*=*Mvv@NQxB@<8<{e_KX3Z1AkrxY>k~N=+WaPt; zjC=!Emx3K14<(E{GYRgPIKVYzGlFZA#aY|U1FM``bFx%lKK zEO9=>Hu~L2>!+AD$l{Y9Fp|P{46Mjw`GmM(+LJJyWW0c3 z_M?p27&!$Ajm>5343|X19=1Beu zt}#*Xla?Vll-fBWxx!sT(ooAHbB!Mhyhn7J+;!45p`W3(0k(d&5?c~VjtQ~n%p-m! pDov`n7@)()iJR$K>tV7`QL*!DbsHu{`;TSjohe9~O;{R=ZKl}B5 zJOOObl*kAR&!Y}*bj~=_aZvjqvTwB!yZuf|ObGK{-?g%OxTwRqXA=pPWGs8_3Hfq$ yA{4FXA+?n-U5LrnM|bmvcUQ}V<_BCSRzZ+Gc?8IXKShCbr~GS`R1!0(8R`#Yh$%(@ literal 0 HcmV?d00001 diff --git a/build/classes/repasopoocoches/Marcas/Ford.class b/build/classes/repasopoocoches/Marcas/Ford.class new file mode 100644 index 0000000000000000000000000000000000000000..14ebf94db297a57329194779f429e00d85170b2c GIT binary patch literal 1015 zcmaJT^+irzXz=crSr)tM+GNd0XUqw$DhAP$lEV2w%T?g$P@+f3r+qi_w4AW=1Uh+Wj zux6kP!=9-aoW>D9=Cuy@4{Cc+p!|bPYwOF}njssp;b4>@+trcug(5hsTRR^B(=FS$ zV!EYc+0jC^dAsTH_sZke^KKt8Wnb~`J0kEEZ?0>Oh<0ft~ zjCeAVK~re2)e9rl>X3y7US}v*{y#qPP=ALMF%%ohm#=zWO9rob@}bkvf_L_LpiDj3 zw4y^5GR!tEuzZuD5JFNdx4O3W#s0}&{oZ) zut;8{=<-vW~@@bM%5<_(F^Rl-@sfa6C>w3#TX^m8H+LQ zIukJ_-IW+KuKN|a81rT=Eg!{LFxj}t7ELy3va6qoD}~z>S5ctoBzp3ssDvWQ6lX9- zYR6HfYK`v76HMR*rf`SQ3w>^t z%n@)tp|ul=%z&0*<2;JWITT9-Tt1iL{wc-AKtHoHi=eiPQWe1qDj-Sap&AklzL+%A?Fd7}bK7sf^PTzi``dQ_n|M-023Zq^g%RW!76Z}eq3SE;D)&f) zjqOet1>AL|@+sQUNrv20>C5OjL$+2w$Rp2S?uqzNsHlJj)7W_j=xWu% z61B;QZDZu@IdN# zm^7jz88Xbb{;&E5Ln#n`S9((Tks@J-BLpPDd#Z49@`Ry6nvbEluj0TJO{p1M!_}?m zePMwV$6F=)x zQp{50TncNY5atk;Vf`YA+654c)VOpZ#KSX)^&yMAW7kjNygg5&29svh(+z0k&uBcN ITn3N-0JJ~3fB*mh literal 0 HcmV?d00001 diff --git a/build/classes/repasopoocoches/Marcas/Renault.class b/build/classes/repasopoocoches/Marcas/Renault.class new file mode 100644 index 0000000000000000000000000000000000000000..2c338eacf294371801f6d2028ee446e66ddf4418 GIT binary patch literal 1027 zcmaJprTC0uvBn2`!m|lRv%jK*)!Xa(XY&+u5@fVnw zSWLVy@z&^HGQOuDOc)l1k!4s2MVCjatCXwU zLlM=t+EE;G*Oe-uXj>;4vQK3o63 zz@fLgS%vxQ6y`pd2tw-s_17&{|>}ddn?2~L;fnV1MaJ74496+aDv5u zpYBUBOO10Wtd&BT16YQ&^B}6{KrB$>;<*qHPa)O@EOL%rJAw1|ER8BmnpIENr;$6Q K@rZI6JpKzvH@V^f literal 0 HcmV?d00001 diff --git a/build/classes/repasopoocoches/Marcas/Toyota.class b/build/classes/repasopoocoches/Marcas/Toyota.class new file mode 100644 index 0000000000000000000000000000000000000000..9ea31229562f7b16fb59213b02bf2b60b222291e GIT binary patch literal 1023 zcmaJ<+fEZv6kVqby^hijPyxA0)pk(o4ZNTtl2jh5FA#iePNzpWq%)_^Oo{%1zknZM zV&Y)pgV9&N$S31IGYuv{oJscCw^_6H+UM7wZ{Go|<53Tx6IzjrNlJ z4iD-{GsCc}V+N~vzz=!7%e}q&cIZoQZ_QXgI{K*LN+v9fGGu!y6rLlgoi&Wj9-ymb z6PI+gcqqEcksaP?x%{1Ux$%4}>6kKcS$B*%yvLJ{j_9^R?!D~`4KZV4R+CM;iV7-6 zf)unVX;ao_%Gme->dfP+iEFq{VB$bH{gC@D?uf1+fk+<)quQwL8b5yn#R7FlanO~70`GL`EAwr9np}Qa3NXT zvfdUJNRJd@ky)3GS%x8eZmmEz?S_L%(gNSa<(-Rp=euU z5yow6BEqD-6k*!7zaST3PM^ifL4h@^a9@dIAY)sL$Ef`K zbt1(qHO|GbW(<)Tz%s0!2T?r-Vv!mv=R({+fmj`|$l6xz820PaG^)tZta`eHM)rip J1InfF@Gnz&x%~hD literal 0 HcmV?d00001 diff --git a/build/classes/repasopoocoches/RepasoPOOCoches.class b/build/classes/repasopoocoches/RepasoPOOCoches.class new file mode 100644 index 0000000000000000000000000000000000000000..1964d0ef0c86d71b561631be25555c967b111e43 GIT binary patch literal 2928 zcmcIm>su6682=qum}MN0RzgX|8_ELd;-yR%MO`GRMT{kEBeKIVEF-gXwwYNByV%9< zY4_6ZS?QO)WIf;`Pd$C^v8Vr}?|re}GrPcW(Z??>4>RYy=RNQIe!urU@5~=Jum1+1 z9amJ8pj1IfLmA2$s!#H99<#WeiS-PfG<1)lyv?*tZ$Cq6w5eY~m|=zQl=n<4cF=M7 zMACG<3aD77K+{l(Du#8Ak>jq&384#p)No_H{`^=^Pr{#5*unzCmVx9#=YvD8=Wty& zg-u)i9dQ-axJyAq!wS^Q0G-3&Qbg`bBn+FQ1IdLv;!OpUzeBoFKn1mu_DY7jXkaxV zEQ^@a!{bf;5t6A+!#!Bdpy(o-!$xe9&gN+fOd5Ad^JWcO&`9%)K_Tvrb`_r&$V^;86T_xE&`w1ZEgJ5X2@Z4J zundPg(zs1SOd88a9K$Y{wrkko`%zrsdfchNF5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Obmd{guM|f(Sl9bN`EnW zlef}adpp{&6G^i7(oDkLMUb{)9Zus}icp6=cn;4Kt$JE{fkvegFwWpbx>w;asqzxh zd6{OCXuj?Y8HZ~KfU(j`~2HiF2xrRr^S{7L{ z=YOPV1!=2%1da5hsQe7_G1nGC;dQ)0ejw|cG@>qpw`ManLT@GcI~x8K(RArFj;AB( z$iNhyNToy5IFXLdXQu ouO)PEldS~r;2hl}G&)bVkMRlpUnJkJ@h#a^8ePKoxQx300L9J`@Bjb+ literal 0 HcmV?d00001 diff --git a/dist/README.TXT b/dist/README.TXT new file mode 100644 index 0000000..43a76a4 --- /dev/null +++ b/dist/README.TXT @@ -0,0 +1,32 @@ +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "RepasoPOOCoches.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, these files (folders) +are not copied. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/dist/RepasoPOOCoches.jar b/dist/RepasoPOOCoches.jar new file mode 100644 index 0000000000000000000000000000000000000000..37a946ab65730aa85efff04bfa086fe9e871c20f GIT binary patch literal 11379 zcmeHN>vJ5%5$`>nbf?qGlFzbi*|M~OKt z6y%|Bdrx5du1eofTvJUg)OBbXHTDI10y{eQblp9ljGD==o}_s0+_59jvrB24jO%AW zs~k$|;ZQrOhSfx(Yf?3rdX-AwiLRle6BCDzO!q1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-!90#0|CZ8aEkXM1Tc>L zV@R>MyC6~*y!Kz9FM>lI0*zmyFT+XRfReA^jYAbv^i}#Ao@)?ptfaH(&exIRj#@e2 zz}rK}sU+8RYVeRplHQ}8)jpn;cHe`DUUIagwF8}cjm93Yp@|wgdWAlFx-&0l@rhr8 z)Ft|}Mo7?#mfAS(BxJTivaR$8;cJeW(zoyil%dDcBej5CiGN4DzooX>l52E))<5gN z_cGl#HS4}cbF+TcAG}PVso7GI()^1eRd$V*X8ou9;mZ`6n)O_x=&V1+W$~$3shssJ z3AwBxuZ48qMxKklLyzO>$J-Ogdy1aMbq=&YqZg3R!P*z;JiWxhTFF&YfNxWP>&a-$KK2L&=(}2rWw1}-+pL)(-I!_8@*y6(@k8PID1nHCj<#R1KA5=w)ZlZtjQ4sncX_OQJ literal 0 HcmV?d00001 diff --git a/manifest.mf b/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..0147240 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..a80b275 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=ffc29890 +build.xml.script.CRC32=b6ac62aa +build.xml.stylesheet.CRC32=f85dc8f2@1.110.0.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=ffc29890 +nbproject/build-impl.xml.script.CRC32=7be500db +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.110.0.48 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 0000000..9b263d1 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=/home/kyman/snap/netbeans/93/build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 0000000..6807a2b --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..892b6cf --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,95 @@ +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.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# 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}/RepasoPOOCoches.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/RepasoPOOCoches +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=19 +javac.target=19 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=RepasoPOOCoches +main.class=repasopoocoches.RepasoPOOCoches +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.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..4face30 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + RepasoPOOCoches + + + + + + + + + diff --git a/src/repasopoocoches/Abstracciones/Coche.java b/src/repasopoocoches/Abstracciones/Coche.java new file mode 100644 index 0000000..083cf1d --- /dev/null +++ b/src/repasopoocoches/Abstracciones/Coche.java @@ -0,0 +1,55 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package repasopoocoches.Abstracciones; + +/** + * + * @author kyman + */ +public abstract class Coche implements repasopoocoches.Interfaces.Coches { + + protected String marca = "Desconocido"; + protected String modelo = "Desconocido"; + public float potencia = 0; + protected float velocidad = 0; + protected float velocidad_maxima = 0; + protected float combustible = 0; + protected float capacidad_del_tanque = 0; + + protected void ejecutar_aceleracion(float unidades){ + + float incremento = unidades * potencia; + + if(incremento > 0){ + if(velocidad < velocidad_maxima && (velocidad += incremento) > velocidad_maxima) + velocidad = velocidad_maxima; + }else if(velocidad != 0 && (velocidad -= incremento) < 0) + velocidad = 0; + + } + + protected float meter_combustible(float cantidad){ + + if(combustible < capacidad_del_tanque){ + if((combustible += cantidad) > capacidad_del_tanque){ + cantidad = combustible - capacidad_del_tanque; + combustible = capacidad_del_tanque; + }else + cantidad = 0; + } + + return cantidad; + } + + @Override + public String toString(){ + return ( + "Coche es el modelo '" + modelo + "' de la marca '" + marca + "' con " + potencia + " de caballos de potencia.\n" + + "Circula a una velocidad de " + velocidad + "km/h de " + velocidad_maxima + "km/h de velocidad máxima.\n" + + "Tiene " + combustible + "l de combustible de un máximo de " + capacidad_del_tanque + " litros." + ); + } + +} diff --git a/src/repasopoocoches/Interfaces/Coches.java b/src/repasopoocoches/Interfaces/Coches.java new file mode 100644 index 0000000..43bda58 --- /dev/null +++ b/src/repasopoocoches/Interfaces/Coches.java @@ -0,0 +1,19 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package repasopoocoches.Interfaces; + +/** + * + * @author kyman + */ +public interface Coches { + + public void acelerar(); + + public void frenar(); + + public void repostar(); + +} diff --git a/src/repasopoocoches/Marcas/Ford.java b/src/repasopoocoches/Marcas/Ford.java new file mode 100644 index 0000000..404a515 --- /dev/null +++ b/src/repasopoocoches/Marcas/Ford.java @@ -0,0 +1,45 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package repasopoocoches.Marcas; + +/** + * + * @author kyman + */ +public class Ford extends repasopoocoches.Abstracciones.Coche { + + protected String marca = "Ford"; + public float potencia = 1.4f; + protected float velocidad_maxima = 270; + protected float capacidad_del_tanque = 60; + + public Ford(String modelo, float rendimiento){ + + this.modelo = modelo; + super.marca = this.marca; + super.potencia = this.potencia * rendimiento; + super.velocidad_maxima = this.velocidad_maxima * rendimiento; + super.capacidad_del_tanque = this.capacidad_del_tanque * rendimiento; + + } + + @Override + public void acelerar() { + ejecutar_aceleracion(25); + } + + @Override + public void frenar() { + ejecutar_aceleracion(-40); + } + + @Override + public void repostar() { + meter_combustible(5); + } + + + +} diff --git a/src/repasopoocoches/Marcas/Peugeut.java b/src/repasopoocoches/Marcas/Peugeut.java new file mode 100644 index 0000000..02f04b9 --- /dev/null +++ b/src/repasopoocoches/Marcas/Peugeut.java @@ -0,0 +1,45 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package repasopoocoches.Marcas; + +/** + * + * @author kyman + */ +public class Peugeut extends repasopoocoches.Abstracciones.Coche { + + protected String marca = "Peugeot"; + public float potencia = .95f; + protected float velocidad_maxima = 220; + protected float capacidad_del_tanque = 50; + + public Peugeut(String modelo, float rendimiento){ + + this.modelo = modelo; + super.marca = this.marca; + super.potencia = this.potencia * rendimiento; + super.velocidad_maxima = this.velocidad_maxima * rendimiento; + super.capacidad_del_tanque = this.capacidad_del_tanque * rendimiento; + + } + + @Override + public void acelerar() { + ejecutar_aceleracion(13); + } + + @Override + public void frenar() { + ejecutar_aceleracion(-24); + } + + @Override + public void repostar() { + meter_combustible(3); + } + + + +} diff --git a/src/repasopoocoches/Marcas/Renault.java b/src/repasopoocoches/Marcas/Renault.java new file mode 100644 index 0000000..e6557db --- /dev/null +++ b/src/repasopoocoches/Marcas/Renault.java @@ -0,0 +1,45 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package repasopoocoches.Marcas; + +/** + * + * @author kyman + */ +public class Renault extends repasopoocoches.Abstracciones.Coche { + + protected String marca = "Reanult"; + public float potencia = .8f; + protected float velocidad_maxima = 180; + protected float capacidad_del_tanque = 40; + + public Renault(String modelo, float rendimiento){ + + this.modelo = modelo; + super.marca = this.marca; + super.potencia = this.potencia * rendimiento; + super.velocidad_maxima = this.velocidad_maxima * rendimiento; + super.capacidad_del_tanque = this.capacidad_del_tanque * rendimiento; + + } + + @Override + public void acelerar() { + ejecutar_aceleracion(10); + } + + @Override + public void frenar() { + ejecutar_aceleracion(-20); + } + + @Override + public void repostar() { + meter_combustible(3); + } + + + +} diff --git a/src/repasopoocoches/Marcas/Toyota.java b/src/repasopoocoches/Marcas/Toyota.java new file mode 100644 index 0000000..27507fd --- /dev/null +++ b/src/repasopoocoches/Marcas/Toyota.java @@ -0,0 +1,45 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package repasopoocoches.Marcas; + +/** + * + * @author kyman + */ +public class Toyota extends repasopoocoches.Abstracciones.Coche { + + protected String marca = "Toyota"; + public float potencia = 1.2f; + protected float velocidad_maxima = 240; + protected float capacidad_del_tanque = 50; + + public Toyota(String modelo, float rendimiento){ + + this.modelo = modelo; + super.marca = this.marca; + super.potencia = this.potencia * rendimiento; + super.velocidad_maxima = this.velocidad_maxima * rendimiento; + super.capacidad_del_tanque = this.capacidad_del_tanque * rendimiento; + + } + + @Override + public void acelerar() { + ejecutar_aceleracion(17); + } + + @Override + public void frenar() { + ejecutar_aceleracion(-31); + } + + @Override + public void repostar() { + meter_combustible(6); + } + + + +} diff --git a/src/repasopoocoches/RepasoPOOCoches.java b/src/repasopoocoches/RepasoPOOCoches.java new file mode 100644 index 0000000..0d41d45 --- /dev/null +++ b/src/repasopoocoches/RepasoPOOCoches.java @@ -0,0 +1,57 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template + */ +package repasopoocoches; + +import java.util.ArrayList; +import java.util.Arrays; +import repasopoocoches.Abstracciones.Coche; +import repasopoocoches.Marcas.Ford; +import repasopoocoches.Marcas.Peugeut; +import repasopoocoches.Marcas.Renault; +import repasopoocoches.Marcas.Toyota; + +/** + * + * @author kyman + */ +public class RepasoPOOCoches { + + // Configuracion. + private static final Coche[] coches = { + new Ford("Mustang", 1.3f), + new Renault("Sedan", .8f), + new Renault("Clio", 2.5f), + new Toyota("Corola", 1.2f), + new Peugeut("207", 2.5f) + }; + // Configuracion. + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + + ArrayList coches = new ArrayList<>(Arrays.asList(RepasoPOOCoches.coches)); + + coches.sort((Object coche_a, Object coche_b) -> (int)( + ((Coche)coche_a).potencia * Math.pow(10, 8) - ((Coche)coche_b).potencia * Math.pow(10, 8) + )); + + for(int i = 0, l = coches.size(); i < l; i ++){ + + Coche coche = coches.get(i); + + coche.acelerar(); + coche.frenar(); + coche.repostar(); + + System.out.println("\n" + coche + "\n"); + + } + + } + +}