Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help in the following, I'm making a game but I was forbidden to use the library java.util.vector, nothing else for arrangements they want

I need help in the following, I'm making a game but I was forbidden to use the library java.util.vector, nothing else for arrangements they want me to do but I do not know how to do the array in the yellow part enclosed

image text in transcribed

image text in transcribed

package practica.no.pkali import Java.uti1.Scanner: import java.util.Vector public class entrenador private string nombre private vector hilanew Vector pokemon> : pokemon [ vectori-new pokemon (11): Scanner in - new Scanner (System.in) //Constructo: //se genera de forma aleanew Scanner (System.in) //Constructortoria un tipo de Pokemon en funcion del numero aux aleator //dentro del constructor public entrenador (String nombre) t System.out.println(1. Charmander ""2. Bulbasur " . Squirtlelh"+4. Pikachu "+"5. Newtro " + "6. Lucarioln"+"Enter your choice:" int posieionl System.out.printin int aux1n.nextInt) switch (aux) case l: vectorl [0]- ne charmanderO 1-0 ; mochila.add (new charmandder break: case 2: vectorl[1] -ne bulbasur posicionl - 1; break; case 3: vectori [2] new squirtle() ; posicioni2 break: case 4: vectorl [3] -new Pikachu) posicionl3 break pubiic String getNombre return noabre: //metod an Pokemon de el indice no se encuentza en el ve lve nul1 public pokemon elige (1 1 }{ rezurn mochaila.get(al: elae rezurn null: /Metodo que muestra 1los Pokemons public void mostrar mochila() que tenemos en 1a mochila junto co yatem.out-printinTinen:+moch11a.aize Pokemon" Syatem.out.pr 1nt1n("Jugador no. 1: "4 "N": "4(1) +" T1pop keron: "+mochila.get(1).getNombre() +" Mivel. ".mochila.get(1).geth1ve1() +" vida: "+moch 1 1a , get (1).geD()); package practica.no.pkali import Java.uti1.Scanner: import java.util.Vector public class entrenador private string nombre private vector hilanew Vector pokemon> : pokemon [ vectori-new pokemon (11): Scanner in - new Scanner (System.in) //Constructo: //se genera de forma aleanew Scanner (System.in) //Constructortoria un tipo de Pokemon en funcion del numero aux aleator //dentro del constructor public entrenador (String nombre) t System.out.println(1. Charmander ""2. Bulbasur " . Squirtlelh"+4. Pikachu "+"5. Newtro " + "6. Lucarioln"+"Enter your choice:" int posieionl System.out.printin int aux1n.nextInt) switch (aux) case l: vectorl [0]- ne charmanderO 1-0 ; mochila.add (new charmandder break: case 2: vectorl[1] -ne bulbasur posicionl - 1; break; case 3: vectori [2] new squirtle() ; posicioni2 break: case 4: vectorl [3] -new Pikachu) posicionl3 break pubiic String getNombre return noabre: //metod an Pokemon de el indice no se encuentza en el ve lve nul1 public pokemon elige (1 1 }{ rezurn mochaila.get(al: elae rezurn null: /Metodo que muestra 1los Pokemons public void mostrar mochila() que tenemos en 1a mochila junto co yatem.out-printinTinen:+moch11a.aize Pokemon" Syatem.out.pr 1nt1n("Jugador no. 1: "4 "N": "4(1) +" T1pop keron: "+mochila.get(1).getNombre() +" Mivel. ".mochila.get(1).geth1ve1() +" vida: "+moch 1 1a , get (1).geD())

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions