Calculatecompoundinterest function