The following diagram shows the classes and methods that provide a design for the class hierarchy specified in this assignment. More details are below.
The abstract class DancingTurtle specifies the abstract method direction that returns a double that represents a direction in degrees. Subclasses must implement this method to determine the direction in which the fish moves on each step. The danceStep method in DancingTurtle has the turtle move a fixed amount in the direction returned by the direction method..
The class LeaderTurtle needs to have its List of directions set by having it passed as a parameter to a constructor and to initialize its dirIndex to zero. Then its direction method should return the value at the current dirIndex in the list.
The class FollowerTurtle simply needs to get its leader set (by passing a parameter to a constructor) and them implement the direction method so that it returns the current direction of its leader.