public class ChickenPart { private ChickenPartType type; private int weight; private String id; public ChickenPart (ChickenPartType type, int weight, String id) { this.type = type; this.weight = weight; this.id = id; } public ChickenPartType getType() { return type; } public int getWeight() { return weight; } public String getId(){ return id; } public String toString() { StringBuffer chicken = new StringBuffer(); chicken.append(""); chicken.append(getType()); chicken.append(" "); chicken.append(getWeight()); chicken.append(" "); chicken.append(getId()); chicken.append(""); return chicken.toString(); } // No leading or trailing spaces are allowed in the string. public static ChickenPart fromString (String chicken) throws MalformedChickenPartException { } public boolean equals(Object o) { if (o instanceof ChickenPart) { ChickenPart cp = (ChickenPart) o; boolean isEqual; isEqual = this.getType().equals(cp.getType()); isEqual = isEqual && (this.getWeight() == cp.getWeight()); isEqual = isEqual && this.getId().equals(cp.getId()); return isEqual; } else { return false; } } }