指数的な増え方 2008/03/24

利子が7%ついた場合の5年後


1.07かけてそれを5回くりかえして合計するか、1.075してそれをかけてもとめることができる。



public class TestA {

public static void main(String[] args) {
System.out.println(a(5));
System.out.println(b(5));
}

static double d = 1.07;
static final double base = 10.77;
static double a(int c){
double b = base;
for(int i=0;i<c;i++){
b *= d;
}
return b;
}

static double b(int c){
return base * Math.pow(d, c);
}
}

: