Advertisement
TorroesPrime

Untitled

Nov 18th, 2021
1,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1.     public hero(String[] hero) {
  2.         /**
  3.          * takes a string array and constructs a hero object.
  4.          */
  5.         this.charisma = Integer.parseInt(hero[2]);
  6.         this.perception = Integer.parseInt(hero[3]);
  7.         this.strength = Integer.parseInt(hero[4]);
  8.         this.dexterity = Integer.parseInt(hero[5]);
  9.         this.name = hero[0];
  10.         this.bio = hero[1];
  11.     }
  12.     public hero(String heroData) {
  13.         this(heroData.split("[,]",0));
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement