1. Member Join Date
Sep 2009
Posts
35
Rep Power
0 Calculate Interest

On my BankAccount program one of the method should calculate interest as below.

Calculate interest: The interest is compounded daily and is calculated as follows

IN = P(1 + i)n  P (n is power, I could not make it as power visually in here)
Where

IN is interest

P is Principle

i is the daily percentage rate calculated as yearly interest / 365

n is the number of days(I make it 30 on my program to calculate monthly interest)

User will enter the balance and annual interest rate. Here is my method and result. I could not apply this formula to my method correctly because my result in not correct. If you guys give me a hand that I will appreciate you.
Java Code:
//Interest Calculation
public void interest()
{
interest = balance * Math.pow((1 + annualInterestRate/365), 30)- balance;
}
Java Code:
john
Enter Your Account Number:
35
Enter Your Begining Balance
200
100
200
Enter the Annual Interest Rate
10
Account Holder Name: john
Account Number 35
[COLOR="Red"]Account Balance: 100.0
Daily Interest Rate 0.0273972602739726
Monthly Interest 124.98424052172155
Account Balance after Interest Added 224.98424052172155[/COLOR]

Process completed.  Reply With Quote

2. What is the value & variable type of annualInterestRate? (Note that it should be a double, otherwise its division by 365 may result in undesired rounding.)  Reply With Quote

3. Member Join Date
Sep 2009
Posts
35
Rep Power
0 value is 10 and data type is double  Reply With Quote

4. If you want it to be a 10% annual interest rate, then its value should be 0.1, not 10.0. When using 10, I get the same number as your program. When using 0.1, I get \$0.825191... which seems right.  Reply With Quote

5. Member Join Date
Sep 2009
Posts
35
Rep Power
0 Thanks I was assuming when I put 10 it was 10% however i was wrong, so when I enter 0.1 I have correct value  Reply With Quote Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•