?? compoundinterest.java
字號:
/**
* @version 1.2 27 Mar 1998
* @author Cay Horstmann
*/
import corejava.*;
public class CompoundInterest
{ public static double futureValue(double initialBalance,
double nyear, double p)
{ return initialBalance * Math.pow(1 + p / 12 / 100,
12 * nyear);
}
public static void main(String[] args)
{ double[][] balance;
balance = new double[5][6];
int i;
int j;
for (i = 0; i < 5; i++)
for (j = 0; j < 6; j++)
balance[i][j] = futureValue(10000, 10 + 10 * i,
5 + 0.5 * j);
System.out.print(" ");
for (j = 0; j < 6; j++)
Format.printf("%9.2f%", 5 + 0.5 * j);
System.out.println("");
for (i = 0; i < 5; i++)
{ Format.printf("%3d", 10 + 10 * i);
for (j = 0; j < 6; j++)
Format.printf("%10.2f", balance[i][j]);
System.out.println("");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -