// class representing a Hyena who laughs // example of a class implementing an interface package interfaceexample; public class Hyena implements NoiseMaker, LivingBeing{ protected double weight; // constructors private Hyena() { weight = 0; } public Hyena(double weight) { this(); this.setWeight(weight); } // accessors and mutators public double getWeight() { return weight; } public void setWeight(double weight) { if (weight >= 0) { this.weight = weight; } } // methods // annoying public void laugh() { System.out.println("HA HA HA HA HA HA HA"); } // really annoying public void makeNoise() { laugh(); laugh(); laugh(); } // utilities @Override public String toString() { return "hyena weighing " + getWeight() + "lbs"; } @Override // equal if weights equal public boolean equals(Object obj) { if (obj != null && obj instanceof Hyena) { Hyena other = (Hyena) obj; return getWeight() == other.getWeight(); } return false; } @Override public int hashCode() { int hash = 3; return hash; } }