• March 19th 2008, 04:53 PM
hechen
Hey,

I forgot the formula for interest.

The formula sloves this:
Let say you got a savings account and you got \$1,000 in it. The interest is 5% every month (i wish) so the formula is 1000 * 1.05 = B B= Balance

But next month it will be 1050 * 1.05 = B

Can you guys give me the formula for this. If i remember right it was like

startbalance [1 + interest ^ 2) * month] = newbalance

But that is wrong i think

Thanks for you help.

EDIT: I think it is this: StartBalance * (1+I)^ number of years
• March 19th 2008, 04:58 PM
topher0805
That is correct just don't square the interest.

NewBalance = 1000(1+0.05)^M

Where M is the number of months.
• March 19th 2008, 05:03 PM
hechen
Quote:

Originally Posted by topher0805
That is correct just don't square the interest.

NewBalance = 1000(1+0.05)^M

Where M is the number of months.

No, because if you do it that way it will always multiply by the \$1,000. The formula i was looking for for every month it will multiply by the last month balance.
• March 19th 2008, 05:14 PM
topher0805
Quote:

Originally Posted by hechen
No, because if you do it that way it will always multiply by the \$1,000. The formula i was looking for for every month it will multiply by the last month balance.

Using my formula:

After Month 1: 1050

Month 2: 1102.5

Month 3: 1157.625

What is wrong with this? This formula will give you the correct balance after any month.
• March 19th 2008, 05:16 PM
hechen
Quote:

Originally Posted by topher0805
Using my formula:

After Month 1: 1050

Month 2: 1102.5

Month 3: 1157.625

What is wrong with this? This formula will give you the correct balance after any month.

Because it for JAVA Programming (Surprised)
• March 19th 2008, 05:18 PM
topher0805
Are you familiar with the compound interest formula? The general formula is:

$C = P(1 + i)^n$

Where P is the principal, i is the interest in decimal form and n is the amount of periods.
• March 19th 2008, 05:20 PM
topher0805
Quote:

Originally Posted by hechen
Because it for JAVA Programming (Surprised)

That doesn't change the formula.
• March 19th 2008, 05:23 PM
hechen
Quote:

Originally Posted by hechen
Because it for JAVA Programming (Surprised)

Quote:

Originally Posted by topher0805
Using my formula:

After Month 1: 1050

Month 2: 1102.5

Month 3: 1157.625

What is wrong with this? This formula will give you the correct balance after any month.

Yeah you gave me that.
In JAVA i need a formula.

Thanks for confirming my EDIT up there.
• March 19th 2008, 05:24 PM
topher0805
Quote:

Originally Posted by hechen
Yeah you gave me that.
In JAVA i need a formula.

Thanks for confirming my EDIT up there.

amount = principal * Math.pow( 1.0 + rate, year );

Something like that...
• March 19th 2008, 05:32 PM
hechen
Quote:

Originally Posted by topher0805
amount = principal * Math.pow( 1.0 + rate, year );

Something like that...

I seen like you know JAVA too.
Do you remember the power symbol for JAVA i kinda forgot about it (Doh)
• March 19th 2008, 05:47 PM
topher0805
Quote:

Originally Posted by hechen
I seen like you know JAVA too.
Do you remember the power symbol for JAVA i kinda forgot about it (Doh)

You don't need it. Just use Math.pow and use the format like I showed.
• March 19th 2008, 05:58 PM
hechen
Quote:

Originally Posted by topher0805
You don't need it. Just use Math.pow and use the format like I showed.

Thanks!

There is my code if you wan to see it:

import java.io.*;
import java.text.NumberFormat;

public class Interest {

public static void main(String args[]) throws IOException {

double Principal, Rate, Month, Balance;
NumberFormat currency = NumberFormat.getCurrencyInstance();

Rate = 5 / 100.00; /*To change the rate change the 5 to any other number.*/
System.out.print("How many months? ");