Tuesday, October 26, 2010

LabTest#2: Revised Solution -- Section 5 -- Class: Monster

public class Monster 
{
 private String name;
 public enum MonsterType { GOBLIN, ZOMBIE, GHOST };
 public MonsterType type;
 
 public enum LiveStatus { LIVING, DEAD };
 public LiveStatus liveStat;
 
 public Monster()
 {
  name = "";
 }
 
 public Monster(String n)
 {
  this.setName(n);
 }
 
 public void setName(String n)
 {
  this.name = n;
 }
 
 public String getName()
 {
  return this.name;
 }
 
 public void setMonsterType(MonsterType m)
 {
  type = m;
 }
 
 public MonsterType getMonsterType()
 {
  return type;
 }
 
 public void setLiveStatus(LiveStatus l)
 {
  liveStat = l;
 }
 
 public LiveStatus getLiveStatus()
 {
  return liveStat;
 }
 
}

No comments: