Skip to content

Instantly share code, notes, and snippets.

@jotka
Created September 2, 2013 17:14
Show Gist options
  • Select an option

  • Save jotka/6415138 to your computer and use it in GitHub Desktop.

Select an option

Save jotka/6415138 to your computer and use it in GitHub Desktop.
r
package finsys.examples.solid;
/**
* Solid AreaCalculator example
*/
public class AreaCalculator {
/**
* Counts the area of provided shapes
* @param shapes an array of Shape interface implementations
* @return sum of the areas
*/
public double countArea(Shape[] shapes) {
double area = 0;
for (Shape shape : shapes) {
area += shape.area();
}
return area;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment