Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help, in the following I'm doing a pokemon game but I need to choose two pokemons for my use and 2 for a

I need help, in the following I'm doing a pokemon game but I need to choose two pokemons for my use and 2 for a rival and also that my rival die, could you help me, please? :(

player class

image text in transcribed

image text in transcribed

battle class

image text in transcribed

image text in transcribed

pokemon class

image text in transcribed

image text in transcribed

import java.util.Scanner; import java.util.Vector: public class entrenador i private String nombre: private Vector mochila e Vector //Constructor //se genera de forma aleatoria un tipo de Pokemon en funcion del numero ux aleatorio //dentro del constructor public entrenador (String nombre) System.out.println(""+ "1. Charmander " + "2. Bulbasur " + "3. Squirtle " + "Enter your choice:") scanner in = new scanner (Systen.in); int aux - in.nextInt ) switch (aux) case l: mochila.add (new charmander) break: case 2: mochila.add (new bulbasur break; case 3 mochila.add (new squirtle )): break: this.nombrenombre: //Getter public String getNombre) return nombre; //metodos //se elige a un Pokemon de la moch11a en funcion del indice recibido (1) y se devuelve 181 e1 indice no se encuentra en el vector se devuelve nul1 public pokemon clige (int 1) it( 3) switch (opcion) t case 1: enemigo.dao (mio.ataquel): break: case 2: enemigo.dao (mio.ataque2)) break case 3: disponible(yocaptura (enemigo)) while (mio.getHp) >0&&enemigo.getHp) > 0&& disponible) //Con este metodo se elege a que pokemon utilizar en la batal1a public pokemon elige ) int opcion; System.out.println ("Elige tu Pokemon: ) opcions.nextInt return yo.elige (opcion) public abstract class pokemon i protected int nivel, ataque, vida, hp, pml, pm2: protected String nombre private Random rand - new Random (System.nanoTime)) Constructor public pokemon (String nombre) i nvel = rand . next Int (5) + 1; //Le sumo 1 al nivel, para tener como mnimo el nivel I this.ataque nive! 5; this . hp = nivel * 10; this.pml-10; this.pm2 10; this.vida = 50; this.nombre = nombre; public void setNivel (int nivel) i this.nivel - nivel; //Getters public int getNivel () i return nivel; public void setHp (int hp) ( this.hphp: public int getHp)i return hp: public int getPm1 i return pml; public void setPm1 (int pml) i this.pml - pml; public int getPm2 i return pm2 public int getPm2 i return pm2 public void setvida (int vida) i this.vida - vida public int getvida ) return vida; public String getNombre () return nombre: public void setPm2 (int pm2) this.pm2-pm2 //metodos public int ataquel () int dao - 0; if (pml > 0) dao- ataque: return dao; public void dao (int vida) i this.vida -- vida; //Sera sobreescrito public abstract int ataque2 ) //Datos //Sipmlemente mostrar por pantalla las datos del pikachu en cuestion public void mostrar ) i System.out.println ("Nombre "+nombre+" Nivel: "+nivel+" Hp "+hp+Vida: "+vida) import java.util.Scanner; import java.util.Vector: public class entrenador i private String nombre: private Vector mochila e Vector //Constructor //se genera de forma aleatoria un tipo de Pokemon en funcion del numero ux aleatorio //dentro del constructor public entrenador (String nombre) System.out.println(""+ "1. Charmander " + "2. Bulbasur " + "3. Squirtle " + "Enter your choice:") scanner in = new scanner (Systen.in); int aux - in.nextInt ) switch (aux) case l: mochila.add (new charmander) break: case 2: mochila.add (new bulbasur break; case 3 mochila.add (new squirtle )): break: this.nombrenombre: //Getter public String getNombre) return nombre; //metodos //se elige a un Pokemon de la moch11a en funcion del indice recibido (1) y se devuelve 181 e1 indice no se encuentra en el vector se devuelve nul1 public pokemon clige (int 1) it( 3) switch (opcion) t case 1: enemigo.dao (mio.ataquel): break: case 2: enemigo.dao (mio.ataque2)) break case 3: disponible(yocaptura (enemigo)) while (mio.getHp) >0&&enemigo.getHp) > 0&& disponible) //Con este metodo se elege a que pokemon utilizar en la batal1a public pokemon elige ) int opcion; System.out.println ("Elige tu Pokemon: ) opcions.nextInt return yo.elige (opcion) public abstract class pokemon i protected int nivel, ataque, vida, hp, pml, pm2: protected String nombre private Random rand - new Random (System.nanoTime)) Constructor public pokemon (String nombre) i nvel = rand . next Int (5) + 1; //Le sumo 1 al nivel, para tener como mnimo el nivel I this.ataque nive! 5; this . hp = nivel * 10; this.pml-10; this.pm2 10; this.vida = 50; this.nombre = nombre; public void setNivel (int nivel) i this.nivel - nivel; //Getters public int getNivel () i return nivel; public void setHp (int hp) ( this.hphp: public int getHp)i return hp: public int getPm1 i return pml; public void setPm1 (int pml) i this.pml - pml; public int getPm2 i return pm2 public int getPm2 i return pm2 public void setvida (int vida) i this.vida - vida public int getvida ) return vida; public String getNombre () return nombre: public void setPm2 (int pm2) this.pm2-pm2 //metodos public int ataquel () int dao - 0; if (pml > 0) dao- ataque: return dao; public void dao (int vida) i this.vida -- vida; //Sera sobreescrito public abstract int ataque2 ) //Datos //Sipmlemente mostrar por pantalla las datos del pikachu en cuestion public void mostrar ) i System.out.println ("Nombre "+nombre+" Nivel: "+nivel+" Hp "+hp+Vida: "+vida)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

Understand how people development is used to retain talent.

Answered: 1 week ago