PointCP demonstrates now a class can be designed that will support both cartesian and polar co-ordinates. It is the basis of several examples in the book "Object-Oriented Software Engineering: Practical Software Development using UML and Java" by Lethbridge and Laganière.
To compile the files execute the following command
javac PointCP.java PointCPTest.java
To run the program
java PointCPTest