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

1. Member Join Date
Aug 2012
Posts
6
Rep Power
0 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  Reply With Quote

2. Moderator  Join Date
Jul 2010
Location
California
Posts
1,638
Rep Power
12 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.  Reply With Quote

3. Member Join Date
Aug 2012
Posts
6
Rep Power
0 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?~  Reply With Quote

4. Member Join Date
Aug 2012
Posts
5
Rep Power
0 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......  Reply With Quote

5. Member Join Date
Aug 2012
Posts
6
Rep Power
0 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  Reply With Quote

6. Member Join Date
Aug 2012
Posts
5
Rep Power
0 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....  Reply With Quote

7. 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  Reply With Quote

8. Member Join Date
Aug 2012
Posts
6
Rep Power
0 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?  Reply With Quote

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

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

kind regards,

Jos  Reply With Quote

10. Member Join Date
Aug 2012
Posts
6
Rep Power
0 Re: program ,deposit of an amount of money in a bank Originally Posted by aou 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.  Reply With Quote

11. Re: program ,deposit of an amount of money in a bank Originally Posted by aou 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.  Reply With Quote

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

You sent this to me as a private message: 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.  Reply With Quote

13. Re: program ,deposit of an amount of money in a bank Originally Posted by Fubarable 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  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
•