|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

05-10-2008, 05:22 PM
|
|
Member
|
|
Join Date: Apr 2008
Location: Bangladesh
Posts: 5
|
|
|
calculating Bank interest rate.
I want to solve interest rate calculation of a Bank.
But i don't know about the algorithm of interest rate calculation for bank.
suppose one customer has a account. ha has 5000US in his account for five month.
so how can i calculate the total interest of 5 months (suppose, monthly interest rate is 0.05 )
Please if any body know about interest calculation of a bank help me...
|
|

05-10-2008, 06:44 PM
|
 |
Senior Member
|
|
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 509
|
|
|
Algorithm? You should know that before converting it to java code.
You can search from the web about it.
come back here and post the algorithm that you have.
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

05-10-2008, 08:21 PM
|
|
Member
|
|
Join Date: Apr 2008
Location: Bangladesh
Posts: 5
|
|
|
thanks for your reply. i will post the algorithm if i can manage....
Best of Luck
|
|

05-12-2008, 10:09 AM
|
|
Senior Member
|
|
Join Date: May 2008
Location: Makati, Philippines
Posts: 173
|
|
Please confirm this Algo.
For Annual Interest Rates:
totalAmmount = (BasicAmmount) x ((InterestRateAnnually)^(NumberOfYears))
or in another algo it may look like this. But they are the same.
for (int i-0; i<NumberOfYears; i++){
basicAmmount = (BasicAmmount) + (BasicAmmount * InterestRateAnnually)}
double CurrMoney=5000,TotalMoney;
int years = 5;
for (int i=0;i<years;i++){
CurrMoney=CurrMoney + (CurrMoney*0.05);
} TotalMoney=CurrMoney;
OR the simplified version
double CurrMoney=5000,TotalMoney;
int years = 5;
TotalMoney=CurrMoney * (1+((0.05)^years));
Last edited by Eku : 05-12-2008 at 10:16 AM.
|
|

05-12-2008, 11:03 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,395
|
|
|
Much better to avoid loops as much as possible. The second way is much better.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on July 13, 2008)
|
|

05-13-2008, 03:11 AM
|
|
Senior Member
|
|
Join Date: May 2008
Location: Makati, Philippines
Posts: 173
|
|
|
The 2nd one is much simplier. Just search on how to use the Exponent. i think '^' doesnt work. =P
|
|

05-13-2008, 05:34 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,395
|
|
Yes it is. For exponent you can't use ^ sign. It's just for pseudo codes. If you it's not work, why you put it there 
Use Math class for those types of processing.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on July 13, 2008)
|
|

05-13-2008, 05:55 AM
|
|
Senior Member
|
|
Join Date: May 2008
Location: Makati, Philippines
Posts: 173
|
|
Thanks for the Tip. Here it is now.
double CurrMoney=5000,TotalMoney;
int years = 5;
TotalMoney=CurrMoney * (1+(java.lang.Math.pow((0.05),years)));
|
|

05-13-2008, 06:06 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,395
|
|
|
Yep it's. But it is not good to import Java packages in runtime. Import them before use, at the top level of any class.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on July 13, 2008)
|
|

05-13-2008, 10:08 AM
|
|
Senior Member
|
|
Join Date: May 2008
Location: Makati, Philippines
Posts: 173
|
|
Thanks for the tips Eranga. Here is the New Code. =)
package test;
import java.lang.Math.*;
public class Main
{
public static void main(String[] args)
{
double CurrMoney=5000,TotalMoney,years = 5;
TotalMoney=CurrMoney * (1+(Math.pow((0.05),years)));
System.out.println(TotalMoney);
}
}
|
|

05-13-2008, 10:30 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,395
|
|
|
Ya, it's much better.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on July 13, 2008)
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|