• Mar 19th 2008, 05: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
• Mar 19th 2008, 05: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.
• Mar 19th 2008, 06: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.
• Mar 19th 2008, 06: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.
• Mar 19th 2008, 06: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)
• Mar 19th 2008, 06: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.
• Mar 19th 2008, 06:20 PM
topher0805
Quote:

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

That doesn't change the formula.
• Mar 19th 2008, 06: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.
• Mar 19th 2008, 06: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...
• Mar 19th 2008, 06: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)
• Mar 19th 2008, 06: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.
• Mar 19th 2008, 06: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? ");