/** Instances are cats with name and age */ public class Cat extends Animal { private double weight; // Must be >= 0 /** Constructor: instance of cat with name, age * Precondition: n not null, empty * age >= 0 */ public Cat(String n, int a) { super(n,a); weight = 9.0; } /** Yields: Cat weight */ public double getWeight() { return weight; } /** Sets Cat weight * Precondition: w >= 0 */ public void setWeight(double w) { weight = w; } /** Yields: noise of this animal */ public String getNoise() { return "meow"; } /** Yields: String representation of this object */ public String toString() { return getName()+" (Cat, age "+getAge()+")"; } /** Yields: Òh is an Cat with the same * name as this animal */ public boolean equals(Cat h) { return getName().equals(h.getName()) && getAge() == h.getAge() && weight == h.weight; } }