public class Snake extends Reptile{ private final static int NUM_LEGS = 0; // all snakes have 0 legs private final int poison_level; // 0 -> 10, once set cannot change public Snake(String name, int age, int weight, boolean poisonous, int poison_level){ super(name, age, weight, poisonous, NUM_LEGS); this.poison_level = poison_level; } public int compareTo(Object o){ try{ if(this.poison_level == ((Snake)o).poison_level) return 0; else if(this.poison_level > ((Snake)o).poison_level) return 1; else return -1; }catch(Exception e){ //if the comparison fails, then we //assume both are not Snakes and //must be compared in the superclass Reptile return super.compareTo(o); } } }