Advertisement
Guest User

caca

a guest
Oct 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1.  
  2. package javaapplication1;
  3. //Cambiar PACKAGE
  4. public class Pokemon
  5. {
  6. private String nombre;
  7. private int nivel;
  8. private int vida;
  9. private String tipo;
  10.  
  11. public Pokemon(String nombre, int nivel, int vida, String tipo) {
  12. this.nombre = nombre;
  13. this.nivel = nivel;
  14. this.vida = vida;
  15. this.tipo = tipo;
  16. }
  17.  
  18. public Pokemon() {
  19. }
  20.  
  21. public String getNombre() {
  22. return nombre;
  23. }
  24.  
  25. public void setNombre(String nombre) {
  26. this.nombre = nombre;
  27. }
  28.  
  29. public int getNivel() {
  30. return nivel;
  31. }
  32.  
  33. public void setNivel(int nivel) {
  34. if(nivel==1||nivel==2||nivel==3)
  35. this.nivel = nivel;
  36. }
  37.  
  38. public int getVida() {
  39. return vida;
  40. }
  41.  
  42. public void setVida(int vida) {
  43. this.vida = vida;
  44. }
  45.  
  46. public String getTipo() {
  47. return tipo;
  48. }
  49.  
  50. public void setTipo(String tipo) {
  51. if(tipo.equals("Fuego")||tipo.equals("Agua")||tipo.equals("Hierba"))
  52. this.tipo = tipo;
  53. }
  54.  
  55. public String datosPokemon(){
  56. return "Pokemon{" + "nombre=" + nombre + ", nivel=" + nivel + ", vida=" + vida + ", tipo=" + tipo + '}';
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement