public class Client { ... public double calculateArea(Object shape) { double area = 0; if (shape instanceof Square) { Square square = (Square) shape; area = square.getA() * square.getA(); } else if (shape instanceof Rectangle) { Rectangle rectangle = (Rectangle) shape; area = rectangle.getA() * rectangle.getB(); } else if (shape instanceof Circle) { Circle circle = (Circle) shape; area = Math.PI * cirle.getR() * cirle.getR(); } return area; } public double calculatePerimeter(Object shape) { double perimeter = 0; if (shape instanceof Square) { Square square = (Square) shape; perimeter = 4 * square.getA(); } else if (shape instanceof Rectangle) { Rectangle rectangle = (Rectangle) shape; perimeter = 2 * (rectangle.getA() + rectangle.getB()); } else if (shape instanceof Circle) { Circle circle = (Circle) shape; perimeter = 2 * Math.PI * cirle.getR(); } return perimeter; } }