Results 1 to 13 of 13
Like Tree7Likes
  • 1 Post By ftftftftftftftft
  • 1 Post By ftftftftftftftft
  • 2 Post By Fubarable
  • 2 Post By Fubarable
  • 1 Post By JosAH

Thread: program ,deposit of an amount of money in a bank

  1. #1
    aou
    aou is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default program ,deposit of an amount of money in a bank

    dear
    please i need ur help on this question please any hint

    A customer makes a deposit of an amount of money in a bank, this amount is designed by IniAmount ,
    The bank gives 6% of compound interest, which means that at the end of the year, the new amount is calculated based on FinAmount.
    What you should do:
    You should write a java code; This code should calculate the FinAmount at the end of each year.
    Java Code:
    The output should have this structure:
    IniAmount = 100 $
    
    Year    FinAmount
    
    1         amount1
    2         amount2
    .          .
    .          .
    .          .
    10       amount10
    And same output, for IniAmount = 1000$.

    Part b:
    In this part, you take the same problem, but this time, you should write a java code, that calculate the number of years, after what the FinAmount becomes the double of IniAmount.
    The output should be as following:
    Java Code:
    IniAmount        Interest   Number of year
    
    100                 3%             n
    1000               2%             n
    10000             1.5%          n

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: program ,deposit of an amount of money in a bank

    Please don't duplicate posts. And we are not a homework service nor a code service, so please don't dump what I presume to be your homework onto the forums. If you have a particular question regarding your attempt, then please ask.

  3. #3
    aou
    aou is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: program ,deposit of an amount of money in a bank

    dear sir
    i need the way of solving this question as i said im newto java

    any hint or psedu cod plz?~

  4. #4
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: program ,deposit of an amount of money in a bank

    look after 1 year it ll be amount * 1.06 right?
    than the second year it will be 1.06 * 1.06 * amount, right?
    third year 1.06 * 1.06 * 1.06 * amount ... right?
    ..... so i guess if you want an easy explicit formula that just does the job you use this one money after n years = 1.06^n * amount......
    .... was this helpful? .....
    aou likes this.

  5. #5
    aou
    aou is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: program ,deposit of an amount of money in a bank

    thank you sir

    what is the formula used to get amount*1.06?

    plz can u write in psedu code so i can do some change
    thanks

  6. #6
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: program ,deposit of an amount of money in a bank

    .... well...... i dont know...... maybe it could look something like this in java.......
    public double moneyAfterNYears(int n){
    return this.amount * Math.pow(1.06, n);
    }
    ..... but i think really you should try a little bit harder yourself.... i will go to bed now.... good luck with your homework....
    aou likes this.

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default Re: program ,deposit of an amount of money in a bank

    Before this starts to be another spoonfeeding thread I suggest the OP to give it a try and come back afterwards if there's still some trouble.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    aou
    aou is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: program ,deposit of an amount of money in a bank

    in question said

    code should calculate the FinAmount at the end of each year.

    how i can do it?

    and as the ftftftft said
    look after 1 year it ll be amount * 1.06 right?
    than the second year it will be 1.06 * 1.06 * amount, right?
    third year 1.06 * 1.06 * 1.06 * amount ... right?
    ..... so i guess if you want an easy explicit formula that just does the job you use this one money after n years = 1.06^n * amount......

    what is the formula used to get amount*1.06?

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default Re: program ,deposit of an amount of money in a bank

    You just wrote it down yourself: newAmount= oldAmount*1.06

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    aou
    aou is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: program ,deposit of an amount of money in a bank

    Quote Originally Posted by aou View Post
    in question said

    code should calculate the FinAmount at the end of each year.

    how i can do it?

    and as the ftftftft said
    look after 1 year it ll be amount * 1.06 right?
    than the second year it will be 1.06 * 1.06 * amount, right?
    third year 1.06 * 1.06 * 1.06 * amount ... right?
    ..... so i guess if you want an easy explicit formula that just does the job you use this one money after n years = 1.06^n * amount......

    what is the formula used to get amount*1.06?
    this number 1.6 frome wher?

    this point still not clear...
    Last edited by aou; 08-04-2012 at 01:50 AM.

  11. #11
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: program ,deposit of an amount of money in a bank

    Quote Originally Posted by aou View Post
    this number 1.6 frome wher?

    this point still not clear...
    Take care not to make sloppy mistakes. It's not 1.6, it's 1.06. 1 is the multiplication identity multiplier and 0.06 is the 6% interest rate. To calculate what a number will be after adding 6% interest, you multiply that number by 1.06. For example if you want to know what %100 will be after adding 6% interest you calculate 100 + 100 * 0.06 which equals 100 * 1 + 100 * 0.06 which equals 100 * (1 + 0.06), which equals 100 * 1.06. QED.
    Last edited by Fubarable; 08-04-2012 at 02:56 AM.
    awinston and aou like this.

  12. #12
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: program ,deposit of an amount of money in a bank

    You sent this to me as a private message:


    Quote Originally Posted by aou
    dear sir
    could plz check if it is the code required for this question



    A customer makes a deposit of an amount of money in a bank, this amount is designed by IniAmount ,
    The bank gives 6% of compound interest, which means that at the end of the year, the new amount is calculated based on FinAmount.
    What you should do:
    You should write a java code; This code should calculate the FinAmount at the end of each year.
    Java Code:
    The output should have this structure:
    IniAmount = 100 $
    Year  FinAmount
    1    amount1
    2    amount2
    .    .
    .    .
    .    .
    10   amount10
    And same output, for IniAmount = 1000$.





    Part b:


    In this part, you take the same problem, but this time, you should write a java code, that calculate the number of years, after what the FinAmount becomes the double of IniAmount.
    The output should be as following:
    Java Code:
    IniAmount  Interest   Number of year
    100             3%           n
    1000            2%           n
    10000            1.5%         n




    ----------------------------------------------------------------------------------------------------------------------------
    the code here and if u can make any change plz and very sory foe pm u here i hope u will help me
    so im waiting ur change of my code ..

    PHP Code:
    public class BankAccount {
        private double amount;
        private double intrestRate;
        
        public BankAccount(double amount, double intrestRate) {
            this.amount = amount;        
            this.intrestRate = intrestRate;
        }
        
        public double calcMoneyAfterNYears(int n){
            return this.amount * Math.pow(this.intrestRate / 100 + 1.0, n);
        }
        
        public void printResult1(){        
            System.out.println("year\tmoney\n" );
            for(int i = 0; i < 10; i++){
                System.out.println(i + "\t" + this.calcMoneyAfterNYears(i));
            }
        }
        
        public int numberOfYearsTillDoubled(){
            int n = 0;
            double tempAmount = 0.0;
            while(true){
                tempAmount = this.calcMoneyAfterNYears(n);
                if(tempAmount >= this.amount * 2){
                    break;
                }
                n++;
            }
            return n;
        }
        
        public void printResult2(){
            System.out.println("amount\tintrest\tyears till doubled\n");
            System.out.println(this.amount +"\t" + this.intrestRate +"\t" + this.numberOfYearsTillDoubled());
        }
        
        public static void main(String[] args){
            BankAccount b = new BankAccount(100.0, 1.06);
            b.printResult1();
            BankAccount b2 = new BankAccount(100.0, 3.0);
            b2.printResult2();
            b2 = new BankAccount(1000.0, 2.0);
            b2.printResult2();
            b2 = new BankAccount(1000.0, 1.5.0);
            b2.printResult2();
            //b2 = new BankAccount(1000.0, 15.0);
            //b2.printResult2();
        }
    }
    any cahnge plzzz
    Please don't sent private messages like this. Instead please let's discuss your issues in public in the forum.
    Thanks.
    awinston and DarrylBurke like this.

  13. #13
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default Re: program ,deposit of an amount of money in a bank

    Quote Originally Posted by Fubarable View Post
    You sent this to me as a private message:

    Please don't sent private messages like this. Instead please let's discuss your issues in public in the forum.
    To you too? The OP really is ignoring my tip about trying it himself first and come back later when he's stuck ...

    kind regards,

    Jos
    Fubarable likes this.
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Bank program difficulties
    By LifeElixer in forum New To Java
    Replies: 8
    Last Post: 10-21-2011, 04:42 AM
  2. Replies: 4
    Last Post: 11-03-2010, 06:17 PM
  3. Replies: 2
    Last Post: 09-25-2010, 07:03 PM
  4. java program for updating bank details
    By java__beginner in forum New To Java
    Replies: 5
    Last Post: 03-12-2009, 03:42 PM
  5. Work & Earn money from home, use rebate lower price save money $$$
    By arturmoniswork in forum Reviews / Advertising
    Replies: 0
    Last Post: 12-30-2008, 05:57 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
  •