/** * class AreaFinder compute area of square, rectangle, circle. * * @author (Andrew Samuels) * @version (03-29-2010) */ public class AreaFinder { private static final double pi = 3.1415; //value of constant pi private static int count = 0; //count of times area computed //computes area of square public static double squareArea(double sideOfSquare) { double areaOfSquare = sideOfSquare * sideOfSquare; count++; return areaOfSquare; } //computes area of rectangle public static double rectangleArea(double width, double height) { double areaOfRectangle = width * height; count++; return areaOfRectangle; } //computes area of circle public static double circleArea(double radius) { double areaOfCircle = pi * radius * radius; count++; return areaOfCircle; } //returns number of times the area computing methods were called public static int getCallCount() { return count; } }
I am a software engineer with a computational physics focus. The purpose of this blog is to showcase my ideas and works. I can create value and reduce costs for your company.