Define an abstract base class Shape that includes protected data members for the (x, y) position of a shape, a public method to move a shape, and a public abstract method show() to output a shape. Derive subclasses for lines, circles and rectangles. Also define the class PolyLine that you saw in this chapter with Shape as its base class. You can represent: a line as two points, a circle as a center and a radius, and a rectangle as two points on diagonally opposite corners. Implement the toString() method for each class. Test the classes by selecting ten random objects of the derived classes, then invoking the show() method for each. Use the toString() methods in the derived classes.
Define a class, ShapeList, that can store an arbitrary collection of any objects of subclasses of the Shape class.
Implement the classes for shapes using an interface for the common methods, rather than inheritance from the superclass, while still keeping Shape as a base class.
Extend the LinkedList class that we defined in this chapter so that it supports traversing the list backwards as well as forwards.
Add methods to the class LinkedList to insert and delete elements at the current position.
Implement a method in the LinkedList class to insert an object following an object passed as an argument. (Assume the objects stored in the list implement an equals() method that compares the This object with an object passed as an argument, and returns true if they are equal.)