Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. package modelos;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import enums.ColorTraje;
  7. import enums.EnumVengadores;
  8. import enums.SuperPoder;
  9.  
  10. public class Personaje {
  11.  
  12. private List<EnumVengadores> nombreLst;
  13. private List<SuperPoder> superPoderLst;
  14. private Integer edad;
  15. private Boolean isMalvado;
  16. private Float estatura;
  17. private List<ColorTraje> colorTrajeLst;
  18.  
  19. public Personaje() {
  20.  
  21. superPoderLst = new ArrayList<SuperPoder>();
  22. nombreLst = new ArrayList<EnumVengadores>();
  23. colorTrajeLst = new ArrayList<ColorTraje>();
  24.  
  25. }
  26.  
  27. public Personaje(List<EnumVengadores> nombreLst, List<SuperPoder> superPoderLst, Integer edad, Boolean isMalvado,
  28. Float estatura, List<ColorTraje> colorTrajeLst) {
  29.  
  30. this.edad = edad;
  31. this.isMalvado = isMalvado;
  32. this.estatura = estatura;
  33.  
  34. if (nombreLst != null) {
  35.  
  36. this.nombreLst = nombreLst;
  37.  
  38. }
  39.  
  40. else {
  41.  
  42. nombreLst = new ArrayList<EnumVengadores>();
  43.  
  44. }
  45.  
  46. if (superPoderLst != null) {
  47.  
  48. this.superPoderLst = superPoderLst;
  49.  
  50. }
  51.  
  52. else {
  53.  
  54. superPoderLst = new ArrayList<SuperPoder>();
  55.  
  56. }
  57.  
  58. if (colorTrajeLst != null) {
  59.  
  60. this.colorTrajeLst = colorTrajeLst;
  61.  
  62. }
  63.  
  64. else {
  65.  
  66. colorTrajeLst = new ArrayList<ColorTraje>();
  67.  
  68. }
  69.  
  70. }
  71.  
  72. public List<EnumVengadores> getNombreLst() {
  73.  
  74. return nombreLst;
  75.  
  76. }
  77.  
  78. public void setNombreLst(List<EnumVengadores> nombreLst) {
  79.  
  80. this.nombreLst = nombreLst;
  81.  
  82. }
  83.  
  84. public List<SuperPoder> getSuperPoderLst() {
  85.  
  86. return superPoderLst;
  87.  
  88. }
  89.  
  90. public void setSuperPoderLst(List<SuperPoder> superPoderLst) {
  91.  
  92. this.superPoderLst = superPoderLst;
  93.  
  94. }
  95.  
  96. public Integer getEdad() {
  97.  
  98. return edad;
  99.  
  100. }
  101.  
  102. public void setEdad(Integer edad) {
  103.  
  104. this.edad = edad;
  105.  
  106. }
  107.  
  108. public Boolean getIsMalvado() {
  109.  
  110. return isMalvado;
  111.  
  112. }
  113.  
  114. public void setIsMalvado(Boolean isMalvado) {
  115.  
  116. this.isMalvado = isMalvado;
  117.  
  118. }
  119.  
  120. public Float getEstatura() {
  121.  
  122. return estatura;
  123.  
  124. }
  125.  
  126. public void setEstatura(Float estatura) {
  127.  
  128. this.estatura = estatura;
  129.  
  130. }
  131.  
  132. public List<ColorTraje> getColorTrajeLst() {
  133.  
  134. return colorTrajeLst;
  135.  
  136. }
  137.  
  138. public void setColorTrajeLst(List<ColorTraje> colorTrajeLst) {
  139.  
  140. this.colorTrajeLst = colorTrajeLst;
  141.  
  142. }
  143.  
  144. package modelos;
  145.  
  146. import java.util.List;
  147.  
  148. import enums.ColorTraje;
  149. import enums.EnumVengadores;
  150. import enums.SuperPoder;
  151.  
  152. public class Heroe extends Personaje {
  153. private Boolean isAvenger;
  154.  
  155. public Heroe() {
  156.  
  157. super();
  158.  
  159. }
  160.  
  161. public Heroe(List<EnumVengadores> nombreLst, List<SuperPoder> superPoderLst, Integer edad, Boolean isMalvado,
  162. Float estatura, List<ColorTraje> colorTrajeLst, Boolean isAvenger) {
  163.  
  164. super(nombreLst, superPoderLst, edad, isMalvado, estatura, colorTrajeLst);
  165. this.isAvenger = isAvenger;
  166.  
  167. }
  168.  
  169. public Boolean getIsAvenger() {
  170.  
  171. return isAvenger;
  172.  
  173. }
  174.  
  175. public void setIsAvenger(Boolean isAvenger) {
  176.  
  177. this.isAvenger = isAvenger;
  178.  
  179. }
  180.  
  181. package modelos;
  182.  
  183. import enums.ColorTraje;
  184. import enums.EnumVengadores;
  185. import enums.SuperPoder;
  186.  
  187. public class mainVengadores {
  188.  
  189. public static void main(String[] args) {
  190. // TODO Auto-generated method stub
  191.  
  192. /*Personaje ironman = new Heroe();
  193. ironman.setEdad(48);
  194. ironman.getNombreLst().add(EnumVengadores.IRONMAN);
  195. ironman.getColorTrajeLst().add(ColorTraje.AMARILLO);
  196.  
  197. System.out.println(ironman);*/
  198.  
  199.  
  200. Personaje hulk=new Personaje(null, null, 45, true, 1.23f, null);
  201.  
  202. hulk.getNombreLst().add(EnumVengadores.HULK);
  203. hulk.getColorTrajeLst().add(ColorTraje.VERDE);
  204. hulk.getColorTrajeLst().add(ColorTraje.AZUL);
  205. hulk.getColorTrajeLst().add(ColorTraje.AMARILLO);
  206. hulk.getSuperPoderLst().add(SuperPoder.Super_Fuerza);
  207.  
  208. System.out.println(hulk);
  209.  
  210. }
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement