Thank you ffor your answer. Yes I want to make an new deposit og �1000 every year. Year 1 1000 + interest = Total amount Year 2 Total amount from year 1 + 1000 + interest of year 2's total amount Henrik
David Smart <[EMAIL PROTECTED]> wrote: Depends on what you want to output. If you only require the final balance at the end of a number of years, then your equation is finalBalance = initialBalance * Math.pow (interestRate, numberOfYears); If you want each year separately, then you simply use a "for" loop to calculate it year by year, multiplying the balance for the year by 1 + 4.5% or 1.045. Note however, that your example numbers do not support this. The first four years should be $1000.00 $1045.00 $1092.03 $1141.17 not what you've got. Does this mean that you want to make an extra deposit during year 3? Dave S ----- Original Message ----- From: exvisu To: [EMAIL PROTECTED] Sent: Friday, October 29, 2004 1:49 AM Subject: [Java] Compound interest, I need help til the Java Code I have got an exercise about compound interest. Year 1 is 1000 � deposit in the bank. At the end of the year the deposit is increased with an interst of 4.5%. Year 2 The balance is now 1045 � + 1000 * 4.5% Year 3 2137.07 * 4.5 % Year 4 2233.24 How do I write this i Java I hope you can help me --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 26/10/04 [Non-text portions of this message have been removed] If you have any comments or questions, submit it on the message board. NO spam/ads/job posting or you will be BANNED from this group. Exception can be made it happen by notify me ahead of time. all new members' message will be verified by me (spam..) before it get posted. Yahoo! Groups Links Venlig hilsen Henrik Saxtorph Mobil 2828 3753 Mail: [EMAIL PROTECTED] www.historie.xtorph.dk [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/5cFolB/TM --------------------------------------------------------------------~-> If you have any comments or questions, submit it on the message board. NO spam/ads/job posting or you will be BANNED from this group. Exception can be made it happen by notify me ahead of time. all new members' message will be verified by me (spam..) before it get posted. Yahoo! Groups Links <*> To reply to this message, go to: http://groups.yahoo.com/group/java_official/post?act=reply&messageNum=17299 Please do not reply to this message via email. More information here: http://help.yahoo.com/help/us/groups/messages/messages-23.html <*> To visit your group on the web, go to: http://groups.yahoo.com/group/java_official/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
