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.

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:

Code:

`IniAmount Interest Number of year`

100 3% n

1000 2% n

10000 1.5% n

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.

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?~

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

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

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

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

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

Quote:

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?

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

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

kind regards,

Jos

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

Quote:

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

Quote:

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

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

Quote:

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.

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.

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:

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

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.

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

Quote:

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