Results 1 to 11 of 11
  1. #1
    dotnet007 is offline Member
    Join Date
    Apr 2008
    Location
    Bangladesh
    Posts
    5
    Rep Power
    0

    Default 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...

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    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.
    freedom exists in the world of ideas

  3. #3
    dotnet007 is offline Member
    Join Date
    Apr 2008
    Location
    Bangladesh
    Posts
    5
    Rep Power
    0

    Default

    thanks for your reply. i will post the algorithm if i can manage....
    Best of Luck

  4. #4
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    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)}

    Java Code:
    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
    Java Code:
    double CurrMoney=5000,TotalMoney;
    int years = 5;
    TotalMoney=CurrMoney * (1+((0.05)^years));
    Last edited by Eku; 05-12-2008 at 10:16 AM.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  6. #6
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    The 2nd one is much simplier. Just search on how to use the Exponent. i think '^' doesnt work. =P

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  8. #8
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    Thanks for the Tip. Here it is now.
    Java Code:
    double CurrMoney=5000,TotalMoney;
    int years = 5;
    TotalMoney=CurrMoney * (1+(java.lang.Math.pow((0.05),years)));

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  10. #10
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    Thanks for the tips Eranga. Here is the New Code. =)
    Java 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);
    	}
    }

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Calculating hyperbolic functions
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:55 PM
  2. Calculating the DB connection time
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-20-2008, 09:55 AM
  3. Calculating sin of a double value
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-13-2008, 09:13 PM
  4. Code bank
    By Eranga in forum Suggestions & Feedback
    Replies: 2
    Last Post: 01-01-2008, 06:23 AM
  5. Help MEEEEEEE! bank project
    By subwoofer717 in forum Advanced Java
    Replies: 1
    Last Post: 12-25-2007, 10:08 AM

Posting Permissions

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