Compound Interest Calculator

hi, im trying to create a compound interest calculator which allows the input of the year you would like to calculate and the amount of money, the interest should already be configured into the code which is of a rate of 5.5 percent
import javax.swing.JOptionPane;
public class Savings
public static void main(String[] args) {
               String input;
               String years;
               double amount;
               double rate = 5.5;
               String input = JOptionPane.showInputDialog("Enter the amount of money");
               double principal = double.parseDouble(input);
               String years = JOptionPane.showInputDialog("Enter the amount of years");
               int nOfyears = int.parseInt(years);
               amount = principal(1+rate)*nOfyears;
               JOptionPane.showMessageDialog(amount);
This is basically what ive written so far but I know there are many mistakes, can someone help me correct it or tell me what I need to add or remove?
Thank you

jakal121 wrote:
OMG, thank you so much for that, it got rid of the problems I was having, I have updated the code now and some of the calculation process but Ive run into another problem, the following is the full updated code:
import javax.swing.JOptionPane;
import java.lang.Math;
public class Savings
     public static void main(String[] args) {
          String input;
          String years;
          double amount;
          double rate = 0.55;
               input = JOptionPane.showInputDialog("Enter the amount of money");
               double principal = Double.parseDouble(input);
               years = JOptionPane.showInputDialog("Enter the amount of years");
               double nOfyears = Double.parseDouble(years);
          amount = principal * Math.pow((1+rate), years);
JOptionPane.showMessageDialog(amount);
}the line which is causing an error is
amount = principal * Math.pow((1+rate), years);the error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol:   variable principal
location: class Savings
at Savings.main(Savings.java:22)p.s thank you for the enormous amount of help georgemcYou're most welcome. I'm not going to fix your other problem for you, though. Instead I'm going to give you two very valuable bits of advice that I think are worth far more than me just correcting your code for you:
1) Next time you have a problem with your code, read, then try to interpret the error messages you get. Nothing else will speed up your productivity than this. They might seem cryptic at first, but they're really not, if you just take the time to think about it. Learn how to do this and you'll find that first of all you manage to fix these problems all on your own, and secondly, that you eventually stop making the mistakes at all. Persevere, trust me!
2) If you really can't figure out what's wrong, and really do need help, feel free to ask here. But make sure your first post explains clearly what the actual problem is. If you've got an error message, tell us what it is. Tell us where you think it's happening. Show a bit of code. Help us to help you, in fact. Makes everyone a happy panda
Good luck

Similar Messages

  • FI Bank Account Interest Calculation

    How to customize compound interest calculation on bank accounts in the Bank Account Interest Calculation?

    Hi,
    The process for configuring the system to calculate Interest on bank account is as follows:-
    1.Define reference Int Rates
    2.Enter Interest Values
    3.Prepare GL account balance interest calculation for interest posting
    Then you execute F.52 for calculating the interest by providing the required parameters
    Regards
    Phani

  • Is it possible to create a compounding interest formula for years?

    Hi forum
    Am recent convert to numbers from Excel. Many built in formulas working fine. But,
    can't find an answer to the subject question or workable formula.
    Has anyone created a formula that reflects a long term stream of compounded interest? Or has it been established that this is beyond numbers capabilities?
    Is numbers formula help just using a different term or expression that does the compounding?
    Any help very much appreciated.
    Mcthomas

    Hi again Jerry and forum
    The FV formula seems to works fine for what it intends but as I understand it is limited for my needs.
    I can get the future value of an amount compounded at 6% over 20 years. I double checked the calculations using an online source.
    I need to show a 20 year compounding buildup year by year. A further complication is that each new annual balance is less a tax calculation.
    Have tried several variations using the FV function as the base but still no cigar.
    Any questions or help appreciated.
    Mcthomas

  • How do we calculate a loan with daily compoundable interest?

    I suppose this might not be strictly a Microsoft Excel subject.  Nevertheless I am helping a friend who is using Excel to store the downloaded data from the bank and trying to calculate the daily balance.  Repayment and withdrawal can be done any
    day.
    I have figured out a formula as follows but the calculations from the formula doesn't seem to tally with the figures I got from the bank.  I love to hear opinions from anyone who is interested.  There is not always a transaction, i.e. withdrawal
    or repayment, every day.  It also takes into account of possible difference of interest rate between two consecutive days.
    The formula is owing = (P(1+I/365)^(today date - date of previous transaction) - credit + debit)(1 + I/365) where P is principal and I interest.
    G96=(F95*(1+I95/365)^(A96-A95)-D96+C96)*(1+I96/365)
    Below is how I try the formula to some data of years ago.
             A                  C               D                 
    F                    G                     I
             DATE            DEBIT        CREDIT         OWING            my
    calculation  INTEREST
    95     23/12/2005                    $650.00        -$52,763.18     -$54,073.49    
    6.96% 
    96     28/12/2005                    $1,500.00     -$51,263.18     -$54,323.86    
    6.96% 
    97     3/01/2006     $519.85                         -$51,783.03     -$50,811.70    
    6.96% 
    98     3/01/2006     $6.50                             -$51,789.53    
    -$51,786.40     6.96% 

    healee wrote previously:
    The formula is owing = (P(1+I/365)^(today date - date of previous transaction) - credit + debit)(1 + I/365) where P is principal and I interest.
    G96=(F95*(1+I95/365)^(A96-A95)-D96+C96)*(1+I96/365)
    Refer to the file "example modified.xlsx" (click here) [1].  This demonstrates two methods for calculating interest on loans based on the following.
    As I noted previously, since you are unable to provide actual bank data that includes interest, there is no way to validate or invalidate the demonstrated methods.  They only serve to clarify the points that I make below.
    If loan interest is computed and compounded daily (which would be unusual, IMHO), your formula is almost correct.
    One problem is the reference to F95, as I said before.  The correct way to do this is to copy the outstanding balance from a bank statement one time into G2.
    The other problem is:  you are double-accounting some interest.  Interest is usually computed based on the account balance at the end of the business day.  All intraday transactions, debits and credits, are netted.
    However, it is more common (AFAIK) to charge simple interest on the daily balance or to use an average daily balance for the billing period.
    Then a minimum payment -- perhaps interest-only -- is billed at the end of the period.  If the minimum payment is not paid within some grace period (e.g. 15 days),
    only then, if at all, is the unpaid interest (and perhaps a penalty) added to the principal, resulting in compounded interest.
    Alternatively, even then unpaid interest and penalties are not added to principal and do not compound.  Instead, unpaid interest and penalties might accumulate separately, eventually resulting in closing the account and collecting or writing off the
    bad debt.
    healee wrote:
    According to
    http://en.wikipedia.org/wiki/Nominal_interest_rate, in finance and economics, nominal interest rate or nominal rate of interest refers to the rate of interest before adjustment for inflation (in contrast with the real interest rate).
    And the sentence continues:  ``or,
    for interest rates "as stated" without adjustment for the full effect of compounding``.
    That is the context in which I meant my comments to be taken. 
    The wiki article is divided into two very different sections:  "Nominal versus real interest" and "Nominal versus effective interest rate".
    It is the latter that we are talking about.
    (If I were a wiki editor, I would spit that article into two in order to "disambiguate" the definitions.)
    healee wrote:
    I have supposed somebody must know how the banks work in terms of calculating the principal and interest though they might vary with regions.  Is it possible the method could very with banks in the same jurisdiction?
    In my experience, bank employees do not understand the mathematical mechanics of the bank's procedures except in general terms.  In any case, generally they are not a reliable source of information.
    In the US, banks and lenders are required to provide a "disclosure statement" which does detail some bank procedures.
    AFAIK, even in the US, such statements are not
    required to explain how interest is calculated.  But the ones that I have studied do.
    And yes:  in the US, two banks in the same city block can use different procedures for charging interest on loans.
    I believe that banks and lenders are only required to use "reasonable" methods for computing actual interest.
    In any case, I do not know anything about Australia banking regulations.  They may be more or less strict.
    Healee wrote:
    When you say Australia interest rates are reported as a nominal (simple) rate, do you mean they are not calculated as compound interest rates?
    No.  How rates are reported can be different from how rates are applied to compute actual interest.  At least, in general.  Again, Australia regulations might dictate something different.
    Moreover, my inference that Australia loan rates are reported as nominal (simple) rates is not dispositive.  It is just suggestive.
    The importance is how we should "de-annualize" a stated interest rate; that is, compute a sub-annual periodic rate.
    But again, how that periodic rate is applied can be something different altogether.
    healee wrote:
    in fact every rate is compounded.  The difference is only when it is compounded.  If it is compounded weekly for argument's sake, then the interest is calculated at a simple rate daily but calculated at a compound rate at the end
    of the weekly cycle.
    That might apply to savings interest.  But we are talking about loan interest (or a line of credit) here.
    Usually, loan interest charged in a billing period is expected to be paid in full.  So normally, loan interest does not compound from one billing period to another.  (What a bank does with unpaid debt varies widely.)
    But that does not tell us how a lender computes intra-period interest.  It can be compounded (typically daily), or it can accrue separately as simple interest.
    Some countries might regulate those details.  Others might allow it to vary from bank to bank.
    [EDIT] PS:  Another factor that I forgot to mention:  rounding.  Whether or not to round interest and when, especially daily interest, is up to the lender and/or government policies.  I purposely do not round interest calculations. 
    But I have seen it done both ways in the US.  I would not sweat the detail until we have some real data to compare to.
    [1] http://www.box.com/s/3v9ajtt0e4vs44ar3s3j

  • Interest calculation

    Hi
    I hv configured the interest calculation as shown below
    1.Define interest calculation type (item interest calculation)
    2.Define number ranges for interest forms(for xxxx company code)
    3.Prepare Interest on Arrears Calculation(selected open and all cleared items, calender type F)
    4.Define reference interest rates
    5.Define Time-Based Terms
    6.Enter Interest Values
    7.Assign Forms for Interest Indicators
    i have made postings in customer both open and cleared items for testing
    but i got message"list contains no data"
    do i need to make any other config.
    useful answers would be rewarded with points
    Regards
    Prasad

    Hi Prasad
    PLease check whether Customer master records are assigned with correct "Interest Indicator" at company code data.
    Best reagards,
    S. Habib Pasha.

  • Interest calculation on Open items and cleared items

    Dear Experts
    I am trying to do needful configuration for interest indicator on which interest can be calculated for open items and cleared items as well.  But,  system is calculating interest for open items properly, but not calculating interest on cleared items with same interest indicator,  I am repeatedly getting error "interest calculation indicator is not compatible with this type of interest calculation"
    Is it possible to use same interest indicator for open line items and cleared line items of customer?
    If possible, request you share the needful config steps to do same.
    points will be awarded for usful reply.
    Best regards,
    S. Habib Pasha.

    Hello Habib,
    depending on the requests you can setup a item interest calculation or a balance interest calculation "Define calculation types".
    IIC: check settings (item selection, all cleared items, only items with payment, no cleared items) "Prepare item interest calculation"
    I guess you have setup the item interest calculation - maybe you have mixed some entries with BAIC.
    Check in "Prepare account balance interest calculation" whether you have entries with the indicator you want to use.
    At least check your entries in "Define time-based Terms" If you have entries with Balance account interest calculation the system gives even an error.
    Hope this is helpfull.
    Best regards
       Horst

  • Dunning interest calculation

    Hi All,
    When I checked table MHND, the dunning interest is calculated in such a way that it doesn't consider the previous dunned date.
    Meaning :
    Dunning ran on 12-01-09 interest calculated is 500.00 ( 2 docuemnst considerded from bsid as seen from table MHND )
    Dunning ran on 15-01.09 interest calculated is 500.00 ( same as above)
    Ideally for Dunning ran on 15-01.09 , it should not calculate interest since on 12th it is done..!!
    Now queries:
    1. Where can i see these interest calculated during dunning run ( any report ? ) other than table..? In std SAP, is this interest
        calculated and shown only in the dunning letter ..? Does it have any other financial impact on outstanding..?
    2. when I try to run the single dunn. notice, and see sample print out it gives message as
    Account D 0004298846 is blocked by dunning run 20090319 MDUN1
    why is it so and how to resolve..?
    thanks,
    Neha

    can some one provide some  advice on this..?
    thanks,
    Neha

  • G/L account interest calculation

    Hello Experts,
    I have an issue with F.52 interest calculation; we have calculating interest for the period 01.07.2011 to 31.07.2011. However, calculation went fine for all G/L account except two G/L account which has calculating interest for earlier periods also.
    We analyze the issue and found out a one possibility, because of field u201CDate of Last Interest Runu201D however this field applies only when there is posting to G/L account with earlier date for which interest already been calculated. I have seen the documents which were wrongly picked in the interest run, and entry date is in earlier monthly only.
    I do not understand why these two G/L accounts is picking the documents in the earlier periods to calculate the interest for the period 01.07.2011 to 31.07.2011.
    Thanks in advance.
    Regards,
    MM

    Hello Mauri,
    Thank you very much for your reply.
    First of all we are not using the G/L updation through this program.
    I have an issue with only for the period 01.07.2011 and 31.07.2011 for two G/L account, and calculation is asolutely fine for all the earlier periods and even for next period 01.08.2011 ot 31.08.2011.
    As per my understanding u201CDate of Last Interest Runu201D, applies only when there is posting to the G/L account with earlier date for which interest already been calculated.
    If I keep the Date of Last Interest Run field blank, it calculate interest only for the period 01.01.2011 to 31.07.2011, however I can.t propose this solution because in all earlier periods they executed F.52 transaction with similar input parameter and calculation is absolutely fine.
    Please let me know your view.
    Regards,
    MM

  • Bank Interest Calculation on Opening and Closing Balance

    Hi Experts,
    I have quiry on bank interest calculation. when was run F.52, giving one months (01.04.2008 to 30.04.2008) calculation period that time system calculate interest from 01.04.2008 to 30.04.2008.
    System calculate interest on Balance Carryforward amount.
    But why the system do not calculate interest on Closing Banlance ?
    1) We do not want the system to calculate interest on Balance Carryforward Amount.
    2) And we want the System to calculate interest on 30.04.2008 (that is on closing balance).
    How this can be done?
    Reliable answer get huge points
    Regards,
    Jemes

    vlauation is at plant level (MBEW table) the storage location level does not carry values (table MARD).
    You may have to develope your own ZMB5B  program and calculate yourself what is not stored in SAP.

  • Customer Interest Calculation - Customer Receipt

    Hi All,
    We have implemented Item Interest Charges for Customer w.e.f Feb 12
    We executed the Interest Run for Jan.12(our first cycle). and the system has posted Interest document for all relevant customer with applicable interest rates in Jan12.
    In Feb12, we received a receipt from a customer for (whom we executed the Interest run) specific to a sales invoice.
    When we tried to clear off the sales invoice the system does not allows to process customer receipt because interest amount has not been paid by customer.
    Accounting department don't want to process Partial/Residual payment for the above transaction.
    Now our management requires that we must have an option to set off the interests charges separately and the interest charge must not be included with sales invoice on customer receipt.
    Lets take an example (for one customer with same currency)
    Sales Invoice 1. 10000EUR
    Sales Invoice 2.  5000EUR
    Sales Invoice 3. 15000 EUR
    Total Open item 30000 EUR
    Interest Calculated for the above invoices (line item) Doc No Interest .1
    Interest Amt : 100 EUR (Sales Invoice 1)
    Interest Amt : 50 EUR (Sales Invoice 2)
    Interest Amt : 150 EUR(Sales Invoice 3)
    Overall Balance end of Jan12 (after Interest Run) : 30300 EUR.
    We received a payment for Sales Invoice.1for 10000 EUR on 5 Feb 12(customer has not paid  the interest amt for sales invoice.1)
    When we process customer receipt (F-28 or F-30), the system is showing an details as Gross : 10000, Partially  Paid Amt 100- and when we select the specific invoice the system  displays an overall 10100 EUR.
    Now our Question is that, is it possible to clear individual sales Invoice (with its original value) and Interest charge separately.
    i.e as per the above case  10000 EUR separately & 100 EUR separately or entire interest amount (300EUR) separately, two different customer receipts.
    As customer state that he will pay the Internet amount separately (as we have generated the Invoice for interest charges) might be complete 300 EUR in single payment or partial.
    Can you provide any lead/workaround to  overcome this scenario.
    We are in ECC 6.2.
    Do revert
    Regards,

    Found the solution. Just remove the tick from Include Invoice ref.in editing option.

  • Interest Calculation for special GL items

    Hi Experts,
    We have posted some special GL indicator documents for the vendors, but in the interest calculation, that is not coming up.
    However the system is picking up all the others debit and credit items for that vendor.
    So what could be going wrong for this vendor?
    Thanks in Advance,
    Jeenat

    Hi,
    Check the transaction code OBAB and assign your special GL transaction to your Interest Indicator.
    This should solve your issue.
    However this setting applies only for account balance interest calculation.
    Regards,
    Gaurav

  • Interest calculation only for open item for customers

    Hi, do you know how to calculate Interest calculation only for open item for customers?I do not want to see cleared   items. I have problem with customization.
    Best Regards
    Tom

    In the item interest calculation, you can tick the  'open items' for calculation of interest and also select the 'no cleared items'.
    Regards

  • Interest Calculation on only future Open items

    Hi,
    We are adopting the interest calculation functionality, we do not want to calculate interest on past open items, i.e, if we go-live on 15.06.08 we do not want to calculate interest on open customer items before this date. We want to calculate interest for all future open items after 15.06.08.
    Does anybody has any answer for this. Can you please guide me in this.
    Thanks,
    Srini

    Hi,
    While creating reference interest indicators give the calulation from date (your required date). Then the system will calculate from date whatever you have mentioned.
    Assign Points if useful
    Regards
    Ravindra

  • Interest calculation on overdue customer open items

    Hi.
    I need to calculate the interest on the customer overdue open items. for that i have configured the following steps.
    OB46 - Interest Settlement Calculation Type
    OB82 - Interest Terms 
    OBAC - Define Reference Interest Rates 
    OB83 - Enter the Reference Interest Rates Value 
    OB81 - Define Time Dependent Terms 
    OBV1 - Prepare Interest on Arrears Calculation
    I have assigned the interest inidicator in the customer master record.
    Now when i run the interest calculation using FINT, it is giving me the error " Problem class very  important" and showing as "No records selected".
    Can anyone help me in this issue.
    Regards,
    Padmavathi

    Dear Mauri,
    Now i got the issue solved.
    In the step Prepare item interest calculation, i have given the ref date as 3 - positng date so only system is not picking the open items.
    Now i changed it to 4 - Payment baseline date. its done.
    Thanks.
    Regards,
    Padmavathi

  • Arrears Interest Calculation on AR Balances

    Hi,
    I am trying to calculate the Interest on AR Balances and was able to successfully post the entries also.  But the problem is the next month when I am running the interest calculation, I want the system to avoid calculating Interest on the document posted for Interest Charges last month to the customer account.
    For example, I have an open item when the first time I calculate Interest.  The programs calculates Interest and posts a document.  Next month, I want the system to calculate interest only on the original invoice or just the invoices, but not on the document posted for Interest, last month.
    Thanks,
    Madhav

    Hi,
    Took an alternative approach to resolve the problem.  Created a seperate document type for posting the Interest Journal Entries and when executing the Interest Calculation, excluded this document type.
    Thanks,
    Madhav

Maybe you are looking for

  • Excel_Work​bookClose in excel2000.​fp generates unwanted "Save As" prompt.

    Hi, I created a LabWindows/CVI application that is developed and built on: Windows XP Pro SP3 Labwindows/CVI 2009 Version 9.1.1 Microsoft Excel 2000 The application generates a report using excel2000.fp activex functions. We've been running successfu

  • Marker Won't Display When Y Axis in Descending Order

    I'm using an RTF to create charts.  I'm using bi-publisher desktop version 11.1.1 and have Office 10 loaded. If I add markerDisplayed="true" to my line chart, the markers display on the line and in the legend.  But, when I add <Y1Axis axisMinAutoScal

  • Accessing Oracle Database from PcoektPC / Palm

    Hi We need to develope a mobile application where client can be Palm or PocketPC device (preferably PocketPC) and the Server is Oracle 9 on Sun Solaris. SOme data will be logged into PDA device and stored in the local database. Thereafter it needs to

  • "Purpose of Payment" Tag in Outgoing DME File for India RTGS Payment

    Hi All While setting up DME tree for India , we need to populate field "Purpose of Payment" as per the norms laid down by the Reserve Bank of India (RBI). Please help on following points if anyone has experience of developing DME tree for RTGS paymen

  • Data set

    Hi I am developing a mobile application about physical fitness for an undergraduate final year project and one of the features I would like to include is to give suggestions to the user on how to make their workout(walking, jogging or running) more e