Advertisement
TorroesPrime

Untitled

Nov 17th, 2021
1,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public class hero {
  2.     /**
  3.      * creates a hero object
  4.      */
  5.     private int charisma;
  6.     private int perception;
  7.     private int strength;
  8.     private int dexterity;
  9.     private String name;
  10.     private String bio;
  11.    
  12.     public hero() {
  13.         this.charisma = 0;
  14.         this.perception = 0;
  15.         this.strength = 0;
  16.         this.dexterity = 0;
  17.         this.name = "No name";
  18.         this.bio = "No name has no bio yet. His adventure has only begun and only time and effort will craft a bio for him.";
  19.     }
  20.     public hero(String[] hero) {
  21.         this.charisma = Integer.parseInt(hero[2]);
  22.         this.perception = Integer.parseInt(hero[3]);
  23.         this.strength = Integer.parseInt(hero[4]);
  24.         this.dexterity = Integer.parseInt(hero[5]);
  25.         this.name = hero[0];
  26.         this.bio = hero[1];
  27.     }
  28.     public hero(String heroData) {
  29.         String[] heroinfo = heroData.split("[,]",0);
  30.         hero(heroinfo);
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement