Commit examen RA4

This commit is contained in:
Isidoro Nevares Martín 2026-04-13 09:18:50 +02:00
commit cf46e141fb
13 changed files with 306 additions and 0 deletions

58
.classpath Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-23">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/bin/
*.class
/target/

34
.project Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>examen_eedd_ra4</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1772465433562</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false

View File

@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

7
pom.xml Normal file
View File

@ -0,0 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.lapaloma.concesionario</groupId>
<artifactId>aadd_concesionario</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>

View File

@ -0,0 +1,34 @@
package eedd.ra4.videojuego;
import eedd.ra4.videojuego.vo.Enemigo;
import eedd.ra4.videojuego.vo.Jugador;
/**
*
* AppVideojuego: Clase que realiza el tratamiento de un videojuego.
*
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 4 dic 2025
*
*
*/
public class AppVideojuego {
public static void main(String[] args) {
Jugador j = new Jugador();
j.nombre = "Héroe";
j.vida = 100;
j.nivel = 5;
j.experiencia = 50;
Enemigo e = new Enemigo();
e.nombre = "Orco";
e.vida = 80;
e.nivel = 3;
e.tipo = "Guerrero";
j.atacar(e);
System.out.println("Vida del enemigo: " + e.vida);
}
}

View File

@ -0,0 +1,16 @@
package eedd.ra4.videojuego.vo;
/**
*
* Enemigo: Clase de persistencia que representa un Enemigo.
*
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 03 marzo 2026
*
*
*/
public class Enemigo extends Personaje {
public String tipo;
}

View File

@ -0,0 +1,27 @@
package eedd.ra4.videojuego.vo;
/**
*
* Jugador: Clase de persistencia que representa un Jugador.
*
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 03 marzo 2026
*
*
*/
public class Jugador extends Personaje {
public int experiencia;
public void ganarExperiencia(int puntos) {
experiencia += puntos;
if (experiencia > 100) {
nivel++;
experiencia = 0;
}
}
public void ataqueEspecial(Enemigo enemigo) {
int danio = nivel * 20;
enemigo.vida -= danio;
}
}

View File

@ -0,0 +1,21 @@
package eedd.ra4.videojuego.vo;
/**
*
* Enemigo: Clase de persistencia que representa un Enemigo.
*
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 03 marzo 2026
*
*
*/
public class Personaje {
public String nombre;
public int vida;
public int nivel;
public void atacar(Personaje objetivo) {
int danio = nivel * 10;
objetivo.vida -= danio;
}
}

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="UP_CONCESIONARIO_ODB" transaction-type="RESOURCE_LOCAL">
<!-- Proveedor de persistencia JPA -->
<provider>com.objectdb.jpa.Provider</provider>
<!-- Clases a "mapear" -->
<class>org.lapaloma.concesionario.vo.Coche</class>
<!-- Configuración de propiedades del SGDB (ObjectDB)-->
<properties>
<property name="jakarta.persistence.jdbc.url" value="objectdb://localhost/Cocensionario.odb" />
<property name="jakarta.persistence.jdbc.user" value="admin"/>
<property name="jakarta.persistence.jdbc.password" value="admin"/>
</properties>
</persistence-unit>
<persistence-unit name="UP_CONCESIONARIO_MYSQL" transaction-type="RESOURCE_LOCAL">
<!-- Proveedor de persistencia JPA -->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<!-- Clases a "mapear" -->
<class>org.lapaloma.concesionario.vo.Coche</class>
<!-- Configuración de propiedades del SGDB (MySQL) -->
<properties>
<property name="jakarta.persistence.jdbc.url" value="jdbc:mysql://192.168.1.36:3306/Concesionario"/>
<property name="jakarta.persistence.jdbc.user" value="root"/>
<property name="jakarta.persistence.jdbc.password" value="mysql_123"/>
<property name="jakarta.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<!-- Configuración Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="none"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
<persistence-unit name="UP_CONCESIONARIO_POSTGRESQL" transaction-type="RESOURCE_LOCAL">
<!-- Proveedor de persistencia JPA -->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<!-- Clases a "mapear" -->
<class>org.lapaloma.concesionario.vo.Coche</class>
<!-- Configuración de propiedades del SGDB (PostgreSQL) -->
<properties>
<property name="jakarta.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.36:5432/Concesionario"/>
<property name="jakarta.persistence.jdbc.user" value="vdlp"/>
<property name="jakarta.persistence.jdbc.password" value="postgresql_123"/>
<property name="jakarta.persistence.jdbc.driver" value="org.postgresql.Driver"/>
<!-- Configuración Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="none"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>

View File

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://192.168.1.36:3306/Concesionario</property>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.username">root</property>
<property name="connection.password">mysql_123</property>
<!-- DB schema will be updated if needed -->
<property name="hbm2ddl.auto">none</property>
<property name="show_sql">false</property>
<property name="format_sql">true</property>
<mapping class="org.lapaloma.concesionario.vo.Coche"></mapping>
</session-factory>
</hibernate-configuration>