Nick

20%
Flag icon
public class Square {      public Point topLeft;      public double side;    }    public class Rectangle {      public Point topLeft;      public double height;      public double width;    }    public class Circle {      public Point center;      public double radius;    }    public class Geometry {      public final double PI = 3.141592653589793;      public double area(Object shape) throws NoSuchShapeException      {        if (shape instanceof Square) {          Square s = (Square)shape;          return s.side * s.side;        }        else if (shape instanceof Rectangle) { ...more
The Robert C. Martin Clean Code Collection (Collection) (Robert C. Martin Series)
Rate this book
Clear rating
Open Preview