//file 1 public enum StatType {HP, MP, STR, END, INT, WIL, SPD, GOLDWORTH, EXPWORTH} //end file 1 //file 2 public class Stat { StatType type; float amount; public Stat(StatType typeIn, float amountIn) { type = typeIn; amount = amountIn; } public float getAmount(){return amount;} public StatType getType(){return type;} public void setAmount(float amountIn){amount=amountIn;} public String toString(){return ""+amount;} } //end file 2 //file 3 public class Monster { //sets default stats String name = "undefined"; Stat STR = new Stat(StatType.STR, 1); //real constructor, define all starting stats public Monster(String nameIn,int hp,int mp,int str,int end,int intel,int wil,int spd,int goldIn,int expIn) { name = nameIn; STR.setAmount(str); } public String getName(){return name;} public Stat getStat( StatType type ){ Stat returnStat; switch( type ){ case STR: returnStat = STR; break; default: returnStat = null; break;// careful! default here returns null } return returnStat; } public void setStat(StatType type, float amount ){ switch( type ){ case STR: STR.setAmount(amount); break; default: break;// careful! default here returns null } //type.setAmount(amount); } public void setStat(Stat type, float amount ){ type.setAmount(amount); } } //end file 3 //file 4 public class Test { Monster m1; public Test() { m1 = new Monster("Goblin",15,5,10,10,10,10,10,5,6); System.out.println("a "+m1.getName()+"! str="+m1.getStat(StatType.STR)); m1.setStat(StatType.STR,3); System.out.println("a "+m1.getName()+"! str="+m1.getStat(StatType.STR)); } public static void main(String[] args){Test test = new Test();} } //end file 4