我希望這不是一個明顯的問題,但我是Java新手,我一直在創建一個複利計算器。我不想採用用戶輸入和計算它們的所有值。關於用Java複數算術運算的困惑
P = present value,
r = rate,
m = times compounded in a year,
t = years compounded.
A = the amount at the end of the term
A是我正在尋找。化合物利益的公式爲
A = P(1+r/m)^mt
。
A = Math.pow((P*(1+r/m)),m*t);
System.out.println("The amount(A) equals "+A);
我覺得我可以知道爲什麼計算是不工作的權利,但我不知道正確的方式。
嗨,你能告訴我什麼是輸入和預期的輸出是什麼? – Suspended
輸入是雙倍的,因爲可能有小數。 P = 555 r = 0.05 m = 1 t = 2並且A是需要找到的那個。 A應該是$ 687.50 – Garrett777