Calculates compound addition (useful for financial calculations).
static double compoundAdd(double principal, double rate, int times) { return principal * math.pow(1 + rate, times); }