Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication1;
- //Cambiar PACKAGE
- public class Pokemon
- {
- private String nombre;
- private int nivel;
- private int vida;
- private String tipo;
- public Pokemon(String nombre, int nivel, int vida, String tipo) {
- setNombre(nombre);
- setNivel(nivel);
- setVida(vida);
- setTipo(tipo);
- }
- public Pokemon() {
- }
- public String getNombre() {
- return nombre;
- }
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
- public int getNivel() {
- return nivel;
- }
- public void setNivel(int nivel) {
- if(nivel==1||nivel==2||nivel==3)
- this.nivel = nivel;
- }
- public int getVida() {
- return vida;
- }
- public void setVida(int vida) {
- this.vida = vida;
- }
- public String getTipo() {
- return tipo;
- }
- public void setTipo(String tipo) {
- if(tipo.equals("Fuego")||tipo.equals("Agua")||tipo.equals("Hierba"))
- this.tipo = tipo;
- }
- public String datosPokemon(){
- return "Pokemon{" + "nombre=" + nombre + ", nivel=" + nivel + ", vida=" + vida + ", tipo=" + tipo + '}';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement