我不知道';我不知道如何处理这个java.lang.ClassCastException

我不知道';我不知道如何处理这个java.lang.ClassCastException,java,Java,我必须做到以下几点: 该课程分为以下几类:12。在我们的竞技场课程中,我们首先定义了魔术师和强壮战士之间的战斗(第一轮)。当这一切结束时,我们必须从我们强大的战士中创造一个普通的战士,他必须与魔术师战斗(第二轮) 重要的是,我们观察到,施法后,我们的战士夺走了强者战士的生命,但他的攻击很简单,没有强者战士拥有的额外点数。实际上,我们的战士似乎在第二轮比赛中失去了力量 Personaje public abstract class Personaje { //attributes

我必须做到以下几点:

该课程分为以下几类:12。在我们的竞技场课程中,我们首先定义了魔术师和强壮战士之间的战斗(第一轮)。当这一切结束时,我们必须从我们强大的战士中创造一个普通的战士,他必须与魔术师战斗(第二轮)

重要的是,我们观察到,施法后,我们的战士夺走了强者战士的生命,但他的攻击很简单,没有强者战士拥有的额外点数。实际上,我们的战士似乎在第二轮比赛中失去了力量

Personaje

public abstract class Personaje {
    //attributes
    int vida ;
    //constructor
    Personaje() {
        vida=100;
    }
    //getters y setters
    public int getVida() {
        return vida;
    }
    public void setVida(int vida) {
        this.vida = vida;
    }

    //abstract method movimientoLucha
    public abstract int movimientoLucha();
}
public  class Mago extends Personaje {
    //attributes
    int magia;
    //Constructor of superclass
    Mago() {

    this.vida=vida+(int)(vida*0.1);
    Date fecha_creacion =new Date();
    GregorianCalendar calendario_creacion=new GregorianCalendar();
    calendario_creacion.setTime(fecha_creacion);
    System.out.println("La fecha de creacion del Mago Test1 es: "
                        +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                        +calendario_creacion.get(Calendar.MONTH)+"/"
                        +calendario_creacion.get(Calendar.YEAR)+" a las "
                        +calendario_creacion.get(Calendar.HOUR)+":"
                        +calendario_creacion.get(Calendar.MINUTE)+":"
                        +calendario_creacion.get(Calendar.SECOND)+":"
                        +calendario_creacion.get(Calendar.MILLISECOND));

    }
    //Getters & setters
    public int getMagia() {
        return magia;
    }
    public void setMagia(int magia) {
        this.magia = magia;
    }
    //Method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*magia);
        System.out.println("****Hechizazo****");
        return movement;
    }
    public void setVida(int vida) {
        super.setVida(vida);
    }
    public int getVida() {
        return vida;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class Guerrero extends Personaje {
    //attributes
    int ataque=0;
    //constructor
    public Guerrero() {
        this.vida=vida;
        ataque=10;
        //Date construction
         Date fecha_creacion = new Date();
         GregorianCalendar calendario_creacion=new GregorianCalendar();
         calendario_creacion.setTime(fecha_creacion);
            System.out.println("La fecha de creacion del Guerrero Test2 es: "
                    +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                    +calendario_creacion.get(Calendar.MONTH)+"/"
                    +calendario_creacion.get(Calendar.YEAR)+" a las "
                    +calendario_creacion.get(Calendar.HOUR)+":"
                    +calendario_creacion.get(Calendar.MINUTE)+":"
                    +calendario_creacion.get(Calendar.SECOND)+":"
                    +calendario_creacion.get(Calendar.MILLISECOND));

    }

    //getters y setters
    public int getAtaque() {
        return ataque;
    }

    public void setAtaque(int ataque) {
        this.ataque = ataque;
    }
    //method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*ataque);
        System.out.println("****Espadazo****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;



public class GuerreroFuerte extends Guerrero {
    GuerreroFuerte()
    {
        this.vida=vida;
        this.ataque=ataque;
        //Date construction
        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Fuerte SuperAnaquin es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }
    //Method
    public int movimientolucha(){
        int movement=((int)(Math.random()*ataque)+5);
        System.out.println("****Espadazooooo super fuerte****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class GuerreroNormal extends GuerreroFuerte {
    GuerreroNormal()
    {
        this.vida=vida;
        this.ataque=ataque;

        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Normal Anaquinino es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }

}
package p1_t5;

import java.util.Scanner;

public class Arena {
    //Creation of method Lucha 
    public static void Lucha(Guerrero Test1, Mago Test2, int danoValor, Integer danoReferencia) {
        System.out.println(Test1.movimientoLucha());
        int dañoMago=Test2.getVida()-Test1.movimientoLucha();
        System.out.println("La vida del Mago Test1 se ha reducido a : "+dañoMago);
        System.out.println(Test1.movimientoLucha());
        int dañoGuerrero=Test1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Test2 se ha reducido a: "+dañoGuerrero);
        danoValor=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por valor es: "+danoValor);
        danoReferencia=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha first round
    public static void Lucha(GuerreroFuerte BigTest1, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(BigTest1.movimientoLucha());
        int dañoMago=Test2.getVida()-BigTest1.movimientoLucha();
        System.out.println("La vida del Mago Test1 en la primera ronda se ha reducido a : "+dañoMago);
        System.out.println(BigTest1.movimientoLucha());
        int dañoGuerrero=BigTest1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del GuerreroFuerte BigTest1 en la primera ronda se ha reducido a: "+dañoGuerrero);
        danoValor=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por valor es: "+danoValor);
        danoReferencia=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha second round 
    public static void Lucha(GuerreroNormal Prueba2, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(Prueba2.movimientoLucha());
        int dañoMago=Test2.getVida()-Prueba2.movimientoLucha();
        System.out.println("La vida del Mago Test2 en la segunda ronda se ha reducido a : "+dañoMago);
        System.out.println(Prueba2.movimientoLucha());
        int dañoGuerrero=Prueba2.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Anaquinino en la segunda ronda  se ha reducido a: "+dañoGuerrero);
        danoValor=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por valor es: "+danoValor);
        danoReferencia=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por referencia es: "+danoReferencia);
        System.out.println("La vida del Mago Test2 en un 10 por ciento mayor: "+Test2.getVida());
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner Entrada=new Scanner(System.in);
        //Inizialization of variables 
        int vida=200;
        int ataque=800;
        //7.Creation of two variables danoValor & wrapper danoReferencia
        int danoValor=0;
        Integer danoReferencia=0;
        //Creation of a warrior 
        final Guerrero Test1=new Guerrero();
        System.out.println("El nivel de vida del guerrero es "+Test1.getVida());
        System.out.println(Test1.movimientoLucha());
        //Creation of a Magician
        final Mago Test2=new Mago();
        System.out.println("El nivel de vida del mago es "+Test2.getVida());
        System.out.println(Test2.movimientoLucha());
        //Call the method
        Lucha(Test1, Test2,danoValor,danoReferencia);
        //Creation of a new Guerrero Fuerte
        GuerreroFuerte BigTest1=new GuerreroFuerte();
        Lucha(BigTest1,Test2, danoValor, danoReferencia);
        GuerreroNormal Prueba2=new GuerreroNormal();
        Prueba2=(GuerreroNormal)BigTest1;
        Lucha (Prueba2, Test2, danoValor, danoReferencia);

    }
}
Mago

public abstract class Personaje {
    //attributes
    int vida ;
    //constructor
    Personaje() {
        vida=100;
    }
    //getters y setters
    public int getVida() {
        return vida;
    }
    public void setVida(int vida) {
        this.vida = vida;
    }

    //abstract method movimientoLucha
    public abstract int movimientoLucha();
}
public  class Mago extends Personaje {
    //attributes
    int magia;
    //Constructor of superclass
    Mago() {

    this.vida=vida+(int)(vida*0.1);
    Date fecha_creacion =new Date();
    GregorianCalendar calendario_creacion=new GregorianCalendar();
    calendario_creacion.setTime(fecha_creacion);
    System.out.println("La fecha de creacion del Mago Test1 es: "
                        +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                        +calendario_creacion.get(Calendar.MONTH)+"/"
                        +calendario_creacion.get(Calendar.YEAR)+" a las "
                        +calendario_creacion.get(Calendar.HOUR)+":"
                        +calendario_creacion.get(Calendar.MINUTE)+":"
                        +calendario_creacion.get(Calendar.SECOND)+":"
                        +calendario_creacion.get(Calendar.MILLISECOND));

    }
    //Getters & setters
    public int getMagia() {
        return magia;
    }
    public void setMagia(int magia) {
        this.magia = magia;
    }
    //Method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*magia);
        System.out.println("****Hechizazo****");
        return movement;
    }
    public void setVida(int vida) {
        super.setVida(vida);
    }
    public int getVida() {
        return vida;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class Guerrero extends Personaje {
    //attributes
    int ataque=0;
    //constructor
    public Guerrero() {
        this.vida=vida;
        ataque=10;
        //Date construction
         Date fecha_creacion = new Date();
         GregorianCalendar calendario_creacion=new GregorianCalendar();
         calendario_creacion.setTime(fecha_creacion);
            System.out.println("La fecha de creacion del Guerrero Test2 es: "
                    +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                    +calendario_creacion.get(Calendar.MONTH)+"/"
                    +calendario_creacion.get(Calendar.YEAR)+" a las "
                    +calendario_creacion.get(Calendar.HOUR)+":"
                    +calendario_creacion.get(Calendar.MINUTE)+":"
                    +calendario_creacion.get(Calendar.SECOND)+":"
                    +calendario_creacion.get(Calendar.MILLISECOND));

    }

    //getters y setters
    public int getAtaque() {
        return ataque;
    }

    public void setAtaque(int ataque) {
        this.ataque = ataque;
    }
    //method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*ataque);
        System.out.println("****Espadazo****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;



public class GuerreroFuerte extends Guerrero {
    GuerreroFuerte()
    {
        this.vida=vida;
        this.ataque=ataque;
        //Date construction
        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Fuerte SuperAnaquin es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }
    //Method
    public int movimientolucha(){
        int movement=((int)(Math.random()*ataque)+5);
        System.out.println("****Espadazooooo super fuerte****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class GuerreroNormal extends GuerreroFuerte {
    GuerreroNormal()
    {
        this.vida=vida;
        this.ataque=ataque;

        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Normal Anaquinino es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }

}
package p1_t5;

import java.util.Scanner;

public class Arena {
    //Creation of method Lucha 
    public static void Lucha(Guerrero Test1, Mago Test2, int danoValor, Integer danoReferencia) {
        System.out.println(Test1.movimientoLucha());
        int dañoMago=Test2.getVida()-Test1.movimientoLucha();
        System.out.println("La vida del Mago Test1 se ha reducido a : "+dañoMago);
        System.out.println(Test1.movimientoLucha());
        int dañoGuerrero=Test1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Test2 se ha reducido a: "+dañoGuerrero);
        danoValor=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por valor es: "+danoValor);
        danoReferencia=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha first round
    public static void Lucha(GuerreroFuerte BigTest1, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(BigTest1.movimientoLucha());
        int dañoMago=Test2.getVida()-BigTest1.movimientoLucha();
        System.out.println("La vida del Mago Test1 en la primera ronda se ha reducido a : "+dañoMago);
        System.out.println(BigTest1.movimientoLucha());
        int dañoGuerrero=BigTest1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del GuerreroFuerte BigTest1 en la primera ronda se ha reducido a: "+dañoGuerrero);
        danoValor=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por valor es: "+danoValor);
        danoReferencia=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha second round 
    public static void Lucha(GuerreroNormal Prueba2, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(Prueba2.movimientoLucha());
        int dañoMago=Test2.getVida()-Prueba2.movimientoLucha();
        System.out.println("La vida del Mago Test2 en la segunda ronda se ha reducido a : "+dañoMago);
        System.out.println(Prueba2.movimientoLucha());
        int dañoGuerrero=Prueba2.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Anaquinino en la segunda ronda  se ha reducido a: "+dañoGuerrero);
        danoValor=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por valor es: "+danoValor);
        danoReferencia=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por referencia es: "+danoReferencia);
        System.out.println("La vida del Mago Test2 en un 10 por ciento mayor: "+Test2.getVida());
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner Entrada=new Scanner(System.in);
        //Inizialization of variables 
        int vida=200;
        int ataque=800;
        //7.Creation of two variables danoValor & wrapper danoReferencia
        int danoValor=0;
        Integer danoReferencia=0;
        //Creation of a warrior 
        final Guerrero Test1=new Guerrero();
        System.out.println("El nivel de vida del guerrero es "+Test1.getVida());
        System.out.println(Test1.movimientoLucha());
        //Creation of a Magician
        final Mago Test2=new Mago();
        System.out.println("El nivel de vida del mago es "+Test2.getVida());
        System.out.println(Test2.movimientoLucha());
        //Call the method
        Lucha(Test1, Test2,danoValor,danoReferencia);
        //Creation of a new Guerrero Fuerte
        GuerreroFuerte BigTest1=new GuerreroFuerte();
        Lucha(BigTest1,Test2, danoValor, danoReferencia);
        GuerreroNormal Prueba2=new GuerreroNormal();
        Prueba2=(GuerreroNormal)BigTest1;
        Lucha (Prueba2, Test2, danoValor, danoReferencia);

    }
}
格雷罗

public abstract class Personaje {
    //attributes
    int vida ;
    //constructor
    Personaje() {
        vida=100;
    }
    //getters y setters
    public int getVida() {
        return vida;
    }
    public void setVida(int vida) {
        this.vida = vida;
    }

    //abstract method movimientoLucha
    public abstract int movimientoLucha();
}
public  class Mago extends Personaje {
    //attributes
    int magia;
    //Constructor of superclass
    Mago() {

    this.vida=vida+(int)(vida*0.1);
    Date fecha_creacion =new Date();
    GregorianCalendar calendario_creacion=new GregorianCalendar();
    calendario_creacion.setTime(fecha_creacion);
    System.out.println("La fecha de creacion del Mago Test1 es: "
                        +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                        +calendario_creacion.get(Calendar.MONTH)+"/"
                        +calendario_creacion.get(Calendar.YEAR)+" a las "
                        +calendario_creacion.get(Calendar.HOUR)+":"
                        +calendario_creacion.get(Calendar.MINUTE)+":"
                        +calendario_creacion.get(Calendar.SECOND)+":"
                        +calendario_creacion.get(Calendar.MILLISECOND));

    }
    //Getters & setters
    public int getMagia() {
        return magia;
    }
    public void setMagia(int magia) {
        this.magia = magia;
    }
    //Method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*magia);
        System.out.println("****Hechizazo****");
        return movement;
    }
    public void setVida(int vida) {
        super.setVida(vida);
    }
    public int getVida() {
        return vida;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class Guerrero extends Personaje {
    //attributes
    int ataque=0;
    //constructor
    public Guerrero() {
        this.vida=vida;
        ataque=10;
        //Date construction
         Date fecha_creacion = new Date();
         GregorianCalendar calendario_creacion=new GregorianCalendar();
         calendario_creacion.setTime(fecha_creacion);
            System.out.println("La fecha de creacion del Guerrero Test2 es: "
                    +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                    +calendario_creacion.get(Calendar.MONTH)+"/"
                    +calendario_creacion.get(Calendar.YEAR)+" a las "
                    +calendario_creacion.get(Calendar.HOUR)+":"
                    +calendario_creacion.get(Calendar.MINUTE)+":"
                    +calendario_creacion.get(Calendar.SECOND)+":"
                    +calendario_creacion.get(Calendar.MILLISECOND));

    }

    //getters y setters
    public int getAtaque() {
        return ataque;
    }

    public void setAtaque(int ataque) {
        this.ataque = ataque;
    }
    //method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*ataque);
        System.out.println("****Espadazo****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;



public class GuerreroFuerte extends Guerrero {
    GuerreroFuerte()
    {
        this.vida=vida;
        this.ataque=ataque;
        //Date construction
        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Fuerte SuperAnaquin es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }
    //Method
    public int movimientolucha(){
        int movement=((int)(Math.random()*ataque)+5);
        System.out.println("****Espadazooooo super fuerte****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class GuerreroNormal extends GuerreroFuerte {
    GuerreroNormal()
    {
        this.vida=vida;
        this.ataque=ataque;

        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Normal Anaquinino es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }

}
package p1_t5;

import java.util.Scanner;

public class Arena {
    //Creation of method Lucha 
    public static void Lucha(Guerrero Test1, Mago Test2, int danoValor, Integer danoReferencia) {
        System.out.println(Test1.movimientoLucha());
        int dañoMago=Test2.getVida()-Test1.movimientoLucha();
        System.out.println("La vida del Mago Test1 se ha reducido a : "+dañoMago);
        System.out.println(Test1.movimientoLucha());
        int dañoGuerrero=Test1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Test2 se ha reducido a: "+dañoGuerrero);
        danoValor=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por valor es: "+danoValor);
        danoReferencia=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha first round
    public static void Lucha(GuerreroFuerte BigTest1, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(BigTest1.movimientoLucha());
        int dañoMago=Test2.getVida()-BigTest1.movimientoLucha();
        System.out.println("La vida del Mago Test1 en la primera ronda se ha reducido a : "+dañoMago);
        System.out.println(BigTest1.movimientoLucha());
        int dañoGuerrero=BigTest1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del GuerreroFuerte BigTest1 en la primera ronda se ha reducido a: "+dañoGuerrero);
        danoValor=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por valor es: "+danoValor);
        danoReferencia=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha second round 
    public static void Lucha(GuerreroNormal Prueba2, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(Prueba2.movimientoLucha());
        int dañoMago=Test2.getVida()-Prueba2.movimientoLucha();
        System.out.println("La vida del Mago Test2 en la segunda ronda se ha reducido a : "+dañoMago);
        System.out.println(Prueba2.movimientoLucha());
        int dañoGuerrero=Prueba2.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Anaquinino en la segunda ronda  se ha reducido a: "+dañoGuerrero);
        danoValor=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por valor es: "+danoValor);
        danoReferencia=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por referencia es: "+danoReferencia);
        System.out.println("La vida del Mago Test2 en un 10 por ciento mayor: "+Test2.getVida());
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner Entrada=new Scanner(System.in);
        //Inizialization of variables 
        int vida=200;
        int ataque=800;
        //7.Creation of two variables danoValor & wrapper danoReferencia
        int danoValor=0;
        Integer danoReferencia=0;
        //Creation of a warrior 
        final Guerrero Test1=new Guerrero();
        System.out.println("El nivel de vida del guerrero es "+Test1.getVida());
        System.out.println(Test1.movimientoLucha());
        //Creation of a Magician
        final Mago Test2=new Mago();
        System.out.println("El nivel de vida del mago es "+Test2.getVida());
        System.out.println(Test2.movimientoLucha());
        //Call the method
        Lucha(Test1, Test2,danoValor,danoReferencia);
        //Creation of a new Guerrero Fuerte
        GuerreroFuerte BigTest1=new GuerreroFuerte();
        Lucha(BigTest1,Test2, danoValor, danoReferencia);
        GuerreroNormal Prueba2=new GuerreroNormal();
        Prueba2=(GuerreroNormal)BigTest1;
        Lucha (Prueba2, Test2, danoValor, danoReferencia);

    }
}
GuerreroFuerte

public abstract class Personaje {
    //attributes
    int vida ;
    //constructor
    Personaje() {
        vida=100;
    }
    //getters y setters
    public int getVida() {
        return vida;
    }
    public void setVida(int vida) {
        this.vida = vida;
    }

    //abstract method movimientoLucha
    public abstract int movimientoLucha();
}
public  class Mago extends Personaje {
    //attributes
    int magia;
    //Constructor of superclass
    Mago() {

    this.vida=vida+(int)(vida*0.1);
    Date fecha_creacion =new Date();
    GregorianCalendar calendario_creacion=new GregorianCalendar();
    calendario_creacion.setTime(fecha_creacion);
    System.out.println("La fecha de creacion del Mago Test1 es: "
                        +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                        +calendario_creacion.get(Calendar.MONTH)+"/"
                        +calendario_creacion.get(Calendar.YEAR)+" a las "
                        +calendario_creacion.get(Calendar.HOUR)+":"
                        +calendario_creacion.get(Calendar.MINUTE)+":"
                        +calendario_creacion.get(Calendar.SECOND)+":"
                        +calendario_creacion.get(Calendar.MILLISECOND));

    }
    //Getters & setters
    public int getMagia() {
        return magia;
    }
    public void setMagia(int magia) {
        this.magia = magia;
    }
    //Method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*magia);
        System.out.println("****Hechizazo****");
        return movement;
    }
    public void setVida(int vida) {
        super.setVida(vida);
    }
    public int getVida() {
        return vida;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class Guerrero extends Personaje {
    //attributes
    int ataque=0;
    //constructor
    public Guerrero() {
        this.vida=vida;
        ataque=10;
        //Date construction
         Date fecha_creacion = new Date();
         GregorianCalendar calendario_creacion=new GregorianCalendar();
         calendario_creacion.setTime(fecha_creacion);
            System.out.println("La fecha de creacion del Guerrero Test2 es: "
                    +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                    +calendario_creacion.get(Calendar.MONTH)+"/"
                    +calendario_creacion.get(Calendar.YEAR)+" a las "
                    +calendario_creacion.get(Calendar.HOUR)+":"
                    +calendario_creacion.get(Calendar.MINUTE)+":"
                    +calendario_creacion.get(Calendar.SECOND)+":"
                    +calendario_creacion.get(Calendar.MILLISECOND));

    }

    //getters y setters
    public int getAtaque() {
        return ataque;
    }

    public void setAtaque(int ataque) {
        this.ataque = ataque;
    }
    //method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*ataque);
        System.out.println("****Espadazo****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;



public class GuerreroFuerte extends Guerrero {
    GuerreroFuerte()
    {
        this.vida=vida;
        this.ataque=ataque;
        //Date construction
        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Fuerte SuperAnaquin es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }
    //Method
    public int movimientolucha(){
        int movement=((int)(Math.random()*ataque)+5);
        System.out.println("****Espadazooooo super fuerte****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class GuerreroNormal extends GuerreroFuerte {
    GuerreroNormal()
    {
        this.vida=vida;
        this.ataque=ataque;

        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Normal Anaquinino es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }

}
package p1_t5;

import java.util.Scanner;

public class Arena {
    //Creation of method Lucha 
    public static void Lucha(Guerrero Test1, Mago Test2, int danoValor, Integer danoReferencia) {
        System.out.println(Test1.movimientoLucha());
        int dañoMago=Test2.getVida()-Test1.movimientoLucha();
        System.out.println("La vida del Mago Test1 se ha reducido a : "+dañoMago);
        System.out.println(Test1.movimientoLucha());
        int dañoGuerrero=Test1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Test2 se ha reducido a: "+dañoGuerrero);
        danoValor=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por valor es: "+danoValor);
        danoReferencia=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha first round
    public static void Lucha(GuerreroFuerte BigTest1, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(BigTest1.movimientoLucha());
        int dañoMago=Test2.getVida()-BigTest1.movimientoLucha();
        System.out.println("La vida del Mago Test1 en la primera ronda se ha reducido a : "+dañoMago);
        System.out.println(BigTest1.movimientoLucha());
        int dañoGuerrero=BigTest1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del GuerreroFuerte BigTest1 en la primera ronda se ha reducido a: "+dañoGuerrero);
        danoValor=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por valor es: "+danoValor);
        danoReferencia=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha second round 
    public static void Lucha(GuerreroNormal Prueba2, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(Prueba2.movimientoLucha());
        int dañoMago=Test2.getVida()-Prueba2.movimientoLucha();
        System.out.println("La vida del Mago Test2 en la segunda ronda se ha reducido a : "+dañoMago);
        System.out.println(Prueba2.movimientoLucha());
        int dañoGuerrero=Prueba2.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Anaquinino en la segunda ronda  se ha reducido a: "+dañoGuerrero);
        danoValor=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por valor es: "+danoValor);
        danoReferencia=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por referencia es: "+danoReferencia);
        System.out.println("La vida del Mago Test2 en un 10 por ciento mayor: "+Test2.getVida());
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner Entrada=new Scanner(System.in);
        //Inizialization of variables 
        int vida=200;
        int ataque=800;
        //7.Creation of two variables danoValor & wrapper danoReferencia
        int danoValor=0;
        Integer danoReferencia=0;
        //Creation of a warrior 
        final Guerrero Test1=new Guerrero();
        System.out.println("El nivel de vida del guerrero es "+Test1.getVida());
        System.out.println(Test1.movimientoLucha());
        //Creation of a Magician
        final Mago Test2=new Mago();
        System.out.println("El nivel de vida del mago es "+Test2.getVida());
        System.out.println(Test2.movimientoLucha());
        //Call the method
        Lucha(Test1, Test2,danoValor,danoReferencia);
        //Creation of a new Guerrero Fuerte
        GuerreroFuerte BigTest1=new GuerreroFuerte();
        Lucha(BigTest1,Test2, danoValor, danoReferencia);
        GuerreroNormal Prueba2=new GuerreroNormal();
        Prueba2=(GuerreroNormal)BigTest1;
        Lucha (Prueba2, Test2, danoValor, danoReferencia);

    }
}
游击队正常

public abstract class Personaje {
    //attributes
    int vida ;
    //constructor
    Personaje() {
        vida=100;
    }
    //getters y setters
    public int getVida() {
        return vida;
    }
    public void setVida(int vida) {
        this.vida = vida;
    }

    //abstract method movimientoLucha
    public abstract int movimientoLucha();
}
public  class Mago extends Personaje {
    //attributes
    int magia;
    //Constructor of superclass
    Mago() {

    this.vida=vida+(int)(vida*0.1);
    Date fecha_creacion =new Date();
    GregorianCalendar calendario_creacion=new GregorianCalendar();
    calendario_creacion.setTime(fecha_creacion);
    System.out.println("La fecha de creacion del Mago Test1 es: "
                        +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                        +calendario_creacion.get(Calendar.MONTH)+"/"
                        +calendario_creacion.get(Calendar.YEAR)+" a las "
                        +calendario_creacion.get(Calendar.HOUR)+":"
                        +calendario_creacion.get(Calendar.MINUTE)+":"
                        +calendario_creacion.get(Calendar.SECOND)+":"
                        +calendario_creacion.get(Calendar.MILLISECOND));

    }
    //Getters & setters
    public int getMagia() {
        return magia;
    }
    public void setMagia(int magia) {
        this.magia = magia;
    }
    //Method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*magia);
        System.out.println("****Hechizazo****");
        return movement;
    }
    public void setVida(int vida) {
        super.setVida(vida);
    }
    public int getVida() {
        return vida;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class Guerrero extends Personaje {
    //attributes
    int ataque=0;
    //constructor
    public Guerrero() {
        this.vida=vida;
        ataque=10;
        //Date construction
         Date fecha_creacion = new Date();
         GregorianCalendar calendario_creacion=new GregorianCalendar();
         calendario_creacion.setTime(fecha_creacion);
            System.out.println("La fecha de creacion del Guerrero Test2 es: "
                    +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                    +calendario_creacion.get(Calendar.MONTH)+"/"
                    +calendario_creacion.get(Calendar.YEAR)+" a las "
                    +calendario_creacion.get(Calendar.HOUR)+":"
                    +calendario_creacion.get(Calendar.MINUTE)+":"
                    +calendario_creacion.get(Calendar.SECOND)+":"
                    +calendario_creacion.get(Calendar.MILLISECOND));

    }

    //getters y setters
    public int getAtaque() {
        return ataque;
    }

    public void setAtaque(int ataque) {
        this.ataque = ataque;
    }
    //method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*ataque);
        System.out.println("****Espadazo****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;



public class GuerreroFuerte extends Guerrero {
    GuerreroFuerte()
    {
        this.vida=vida;
        this.ataque=ataque;
        //Date construction
        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Fuerte SuperAnaquin es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }
    //Method
    public int movimientolucha(){
        int movement=((int)(Math.random()*ataque)+5);
        System.out.println("****Espadazooooo super fuerte****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class GuerreroNormal extends GuerreroFuerte {
    GuerreroNormal()
    {
        this.vida=vida;
        this.ataque=ataque;

        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Normal Anaquinino es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }

}
package p1_t5;

import java.util.Scanner;

public class Arena {
    //Creation of method Lucha 
    public static void Lucha(Guerrero Test1, Mago Test2, int danoValor, Integer danoReferencia) {
        System.out.println(Test1.movimientoLucha());
        int dañoMago=Test2.getVida()-Test1.movimientoLucha();
        System.out.println("La vida del Mago Test1 se ha reducido a : "+dañoMago);
        System.out.println(Test1.movimientoLucha());
        int dañoGuerrero=Test1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Test2 se ha reducido a: "+dañoGuerrero);
        danoValor=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por valor es: "+danoValor);
        danoReferencia=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha first round
    public static void Lucha(GuerreroFuerte BigTest1, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(BigTest1.movimientoLucha());
        int dañoMago=Test2.getVida()-BigTest1.movimientoLucha();
        System.out.println("La vida del Mago Test1 en la primera ronda se ha reducido a : "+dañoMago);
        System.out.println(BigTest1.movimientoLucha());
        int dañoGuerrero=BigTest1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del GuerreroFuerte BigTest1 en la primera ronda se ha reducido a: "+dañoGuerrero);
        danoValor=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por valor es: "+danoValor);
        danoReferencia=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha second round 
    public static void Lucha(GuerreroNormal Prueba2, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(Prueba2.movimientoLucha());
        int dañoMago=Test2.getVida()-Prueba2.movimientoLucha();
        System.out.println("La vida del Mago Test2 en la segunda ronda se ha reducido a : "+dañoMago);
        System.out.println(Prueba2.movimientoLucha());
        int dañoGuerrero=Prueba2.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Anaquinino en la segunda ronda  se ha reducido a: "+dañoGuerrero);
        danoValor=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por valor es: "+danoValor);
        danoReferencia=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por referencia es: "+danoReferencia);
        System.out.println("La vida del Mago Test2 en un 10 por ciento mayor: "+Test2.getVida());
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner Entrada=new Scanner(System.in);
        //Inizialization of variables 
        int vida=200;
        int ataque=800;
        //7.Creation of two variables danoValor & wrapper danoReferencia
        int danoValor=0;
        Integer danoReferencia=0;
        //Creation of a warrior 
        final Guerrero Test1=new Guerrero();
        System.out.println("El nivel de vida del guerrero es "+Test1.getVida());
        System.out.println(Test1.movimientoLucha());
        //Creation of a Magician
        final Mago Test2=new Mago();
        System.out.println("El nivel de vida del mago es "+Test2.getVida());
        System.out.println(Test2.movimientoLucha());
        //Call the method
        Lucha(Test1, Test2,danoValor,danoReferencia);
        //Creation of a new Guerrero Fuerte
        GuerreroFuerte BigTest1=new GuerreroFuerte();
        Lucha(BigTest1,Test2, danoValor, danoReferencia);
        GuerreroNormal Prueba2=new GuerreroNormal();
        Prueba2=(GuerreroNormal)BigTest1;
        Lucha (Prueba2, Test2, danoValor, danoReferencia);

    }
}
竞技场

public abstract class Personaje {
    //attributes
    int vida ;
    //constructor
    Personaje() {
        vida=100;
    }
    //getters y setters
    public int getVida() {
        return vida;
    }
    public void setVida(int vida) {
        this.vida = vida;
    }

    //abstract method movimientoLucha
    public abstract int movimientoLucha();
}
public  class Mago extends Personaje {
    //attributes
    int magia;
    //Constructor of superclass
    Mago() {

    this.vida=vida+(int)(vida*0.1);
    Date fecha_creacion =new Date();
    GregorianCalendar calendario_creacion=new GregorianCalendar();
    calendario_creacion.setTime(fecha_creacion);
    System.out.println("La fecha de creacion del Mago Test1 es: "
                        +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                        +calendario_creacion.get(Calendar.MONTH)+"/"
                        +calendario_creacion.get(Calendar.YEAR)+" a las "
                        +calendario_creacion.get(Calendar.HOUR)+":"
                        +calendario_creacion.get(Calendar.MINUTE)+":"
                        +calendario_creacion.get(Calendar.SECOND)+":"
                        +calendario_creacion.get(Calendar.MILLISECOND));

    }
    //Getters & setters
    public int getMagia() {
        return magia;
    }
    public void setMagia(int magia) {
        this.magia = magia;
    }
    //Method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*magia);
        System.out.println("****Hechizazo****");
        return movement;
    }
    public void setVida(int vida) {
        super.setVida(vida);
    }
    public int getVida() {
        return vida;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class Guerrero extends Personaje {
    //attributes
    int ataque=0;
    //constructor
    public Guerrero() {
        this.vida=vida;
        ataque=10;
        //Date construction
         Date fecha_creacion = new Date();
         GregorianCalendar calendario_creacion=new GregorianCalendar();
         calendario_creacion.setTime(fecha_creacion);
            System.out.println("La fecha de creacion del Guerrero Test2 es: "
                    +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                    +calendario_creacion.get(Calendar.MONTH)+"/"
                    +calendario_creacion.get(Calendar.YEAR)+" a las "
                    +calendario_creacion.get(Calendar.HOUR)+":"
                    +calendario_creacion.get(Calendar.MINUTE)+":"
                    +calendario_creacion.get(Calendar.SECOND)+":"
                    +calendario_creacion.get(Calendar.MILLISECOND));

    }

    //getters y setters
    public int getAtaque() {
        return ataque;
    }

    public void setAtaque(int ataque) {
        this.ataque = ataque;
    }
    //method
    public int movimientoLucha(){
        int movement=(int)(Math.random()*ataque);
        System.out.println("****Espadazo****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;



public class GuerreroFuerte extends Guerrero {
    GuerreroFuerte()
    {
        this.vida=vida;
        this.ataque=ataque;
        //Date construction
        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Fuerte SuperAnaquin es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }
    //Method
    public int movimientolucha(){
        int movement=((int)(Math.random()*ataque)+5);
        System.out.println("****Espadazooooo super fuerte****");
        return movement;
    }
}
package p1_t5;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.DateFormat;

public class GuerreroNormal extends GuerreroFuerte {
    GuerreroNormal()
    {
        this.vida=vida;
        this.ataque=ataque;

        Date fecha_creacion=new Date();
        GregorianCalendar calendario_creacion=new GregorianCalendar();
        calendario_creacion.setTime(fecha_creacion);
        System.out.println("La fecha de creacion del Guerrero Normal Anaquinino es: "
                            +calendario_creacion.get(Calendar.DAY_OF_MONTH)+"/"
                            +calendario_creacion.get(Calendar.MONTH)+"/"
                            +calendario_creacion.get(Calendar.YEAR)+" a las "
                            +calendario_creacion.get(Calendar.HOUR)+":"
                            +calendario_creacion.get(Calendar.MINUTE)+":"
                            +calendario_creacion.get(Calendar.SECOND)+":"
                            +calendario_creacion.get(Calendar.MILLISECOND));
    }

}
package p1_t5;

import java.util.Scanner;

public class Arena {
    //Creation of method Lucha 
    public static void Lucha(Guerrero Test1, Mago Test2, int danoValor, Integer danoReferencia) {
        System.out.println(Test1.movimientoLucha());
        int dañoMago=Test2.getVida()-Test1.movimientoLucha();
        System.out.println("La vida del Mago Test1 se ha reducido a : "+dañoMago);
        System.out.println(Test1.movimientoLucha());
        int dañoGuerrero=Test1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Test2 se ha reducido a: "+dañoGuerrero);
        danoValor=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por valor es: "+danoValor);
        danoReferencia=Test1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha first round
    public static void Lucha(GuerreroFuerte BigTest1, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(BigTest1.movimientoLucha());
        int dañoMago=Test2.getVida()-BigTest1.movimientoLucha();
        System.out.println("La vida del Mago Test1 en la primera ronda se ha reducido a : "+dañoMago);
        System.out.println(BigTest1.movimientoLucha());
        int dañoGuerrero=BigTest1.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del GuerreroFuerte BigTest1 en la primera ronda se ha reducido a: "+dañoGuerrero);
        danoValor=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por valor es: "+danoValor);
        danoReferencia=BigTest1.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la primera ronda por referencia es: "+danoReferencia);
    }

    //Creation of method Lucha second round 
    public static void Lucha(GuerreroNormal Prueba2, Mago Test2, int danoValor, Integer danoReferencia){
        System.out.println(Prueba2.movimientoLucha());
        int dañoMago=Test2.getVida()-Prueba2.movimientoLucha();
        System.out.println("La vida del Mago Test2 en la segunda ronda se ha reducido a : "+dañoMago);
        System.out.println(Prueba2.movimientoLucha());
        int dañoGuerrero=Prueba2.getVida()-Test2.movimientoLucha();
        System.out.println("La vida del Guerrero Anaquinino en la segunda ronda  se ha reducido a: "+dañoGuerrero);
        danoValor=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por valor es: "+danoValor);
        danoReferencia=Prueba2.movimientoLucha()+Test2.movimientoLucha();
        System.out.println("El daño acumulado en la segunda ronda por referencia es: "+danoReferencia);
        System.out.println("La vida del Mago Test2 en un 10 por ciento mayor: "+Test2.getVida());
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner Entrada=new Scanner(System.in);
        //Inizialization of variables 
        int vida=200;
        int ataque=800;
        //7.Creation of two variables danoValor & wrapper danoReferencia
        int danoValor=0;
        Integer danoReferencia=0;
        //Creation of a warrior 
        final Guerrero Test1=new Guerrero();
        System.out.println("El nivel de vida del guerrero es "+Test1.getVida());
        System.out.println(Test1.movimientoLucha());
        //Creation of a Magician
        final Mago Test2=new Mago();
        System.out.println("El nivel de vida del mago es "+Test2.getVida());
        System.out.println(Test2.movimientoLucha());
        //Call the method
        Lucha(Test1, Test2,danoValor,danoReferencia);
        //Creation of a new Guerrero Fuerte
        GuerreroFuerte BigTest1=new GuerreroFuerte();
        Lucha(BigTest1,Test2, danoValor, danoReferencia);
        GuerreroNormal Prueba2=new GuerreroNormal();
        Prueba2=(GuerreroNormal)BigTest1;
        Lucha (Prueba2, Test2, danoValor, danoReferencia);

    }
}

请用英语。如果你想用西班牙语:我已经改了,对不起!!请将ClassCastException的整个堆栈跟踪作为代码格式的块包含在问题中。如果您能指出发生异常的代码行,这也会很有用。在github repo上共享您的代码将有助于我们帮助您学习英语。如果您想使用西班牙语:我已经更改了,对不起!!请将ClassCastException的整个堆栈跟踪作为代码格式的块包含在问题中。如果您能指出发生异常的代码行,这也会很有用。在github repo上共享您的代码将有助于我们帮助您