// CSE 142 Lecture 20 // Interacting with Super Class // This class represents a Cougar. It moves west until it finds food, // then east until it finds food and repeats. It is blue until it // fights and then red afterwards. It always pounces and displays as a C. import java.awt.*; // For Color public class Cougar extends Critter { private boolean hasFought; private boolean west; public Cougar() { west = true; hasFought = false; } public boolean eat() { west = !west; return true; } public Color getColor() { if (!hasFought) { return Color.BLUE; } else { return Color.RED; } } public Attack fight(String opponent) { hasFought = true; return Attack.POUNCE; } public String toString() { return "C"; } public Direction getMove() { if (west) return Direction.WEST; else return Direction.EAST; } }