Methods Summary |
---|
protected java.lang.String | buildLogMessage(java.lang.Exception ex)Builds a log message from an exception.
StringBuffer buf = new StringBuffer(200);
StackTraceElement[] elements = ex.getStackTrace();
buf.append("The exception ");
buf.append(ex.getClass().getName());
buf.append(" occurred at ");
buf.append(Calendar.getInstance().getTime().toString());
buf.append(" on line ");
buf.append(elements[0].getLineNumber());
return buf.toString();
|
public float | calculateInterest(float rate, float principal)Calculate interest for one time period on the principal.
final String LOG_MSG1 = "Rate cannot be less than ";
final String LOG_MSG2 = ". The rate input = ";
final double MIN_INTEREST = 0.0;
// --
if (rate < MIN_INTEREST) {
LOGGER.error(LOG_MSG1 + MIN_INTEREST + LOG_MSG2 + rate);
throw new IllegalArgumentException("rate");
}
return principal * rate;
|
public double | getCircleArea(double radius)Calculate the area of the circle with the given radius.
double area = (Math.pow(radius, 2) * PI);
LOGGER.debug("The calculated area is " + area);
return area;
|