Results 1 to 5 of 5
Like Tree2Likes
  • 2 Post By gimbal2

Thread: Importing Math fomula to java HELP!!

  1. #1
    langdonh is offline Member
    Join Date
    Sep 2014
    Posts
    1
    Rep Power
    0

    Default Importing Math fomula to java HELP!!

    i am trying to calculate the number of months it takes to pay off a set amount of credit card debt given the following information: principle amount, annual
    interest rate, and monthly payment. does anyone know how to import the formula necessary to system.out.print the answer (number of months it takes to
    pay off debt) ??? thanks!!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: Importing Math fomula to java HELP!!

    how to import the formula
    I think you have to type the program into a java source file. I don't think it can be imported.
    Maybe copy and paste would work if you find another source to copy it from.
    If you don't understand my response, don't ignore it, ask a question.

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

    Default Re: Importing Math fomula to java HELP!!

    As Norm already wrote: you can't import a mathematical formula in Java; you have to translate it to Java; this can be easy or difficult; it depends on the formula and the notation used.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    Whisperer is offline Member
    Join Date
    Aug 2011
    Location
    Cornwall, UK
    Posts
    25
    Rep Power
    0

    Default Re: Importing Math fomula to java HELP!!

    Quote Originally Posted by langdonh View Post
    i am trying to calculate the number of months it takes to pay off a set amount of credit card debt given the following information: principle amount, annual
    interest rate, and monthly payment....
    If you have a loan of 1000, an interest rate of 10% and a repayment of 25, you will need to use a loop together with some conditional states and an incremented month count to arrive at the answer.

    At the start of the loan (month 0) the balance will be the principal times the interest (1050)

    Between months 1 and 11 the loan will decrease by the monthly repayment.

    On this and every other subsequent time that the month count leaves a 0 remainder when divided by 12 the interest is applied for the next 12 months.

    You will require variables for the principal, the interest, the repayment, the balance and the number of months suitably initialised.

    I would use a 'While ? >= 0' loop with an embedded 'If ? = 0' conditional statement. After the while loop you will need code for the final clean-up 'If ? > 0' to cater for any final repayment.

    HTH
    P.S. It would take 51 months with a final repayment of less than 16

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,367
    Rep Power
    6

    Default Re: Importing Math fomula to java HELP!!

    Quote Originally Posted by JosAH View Post
    As Norm already wrote: you can't import a mathematical formula in Java; you have to translate it to Java; this can be easy or difficult; it depends on the formula and the notation used.

    kind regards,

    Jos
    In other words: you have to import it into your brain first and then export it to Java from there ;)
    Whisperer and DarrylBurke like this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Importing a .java class
    By natdizzle in forum Eclipse
    Replies: 3
    Last Post: 01-15-2012, 01:05 AM
  2. Importing Java API's into Eclipse
    By ryan.jones in forum New To Java
    Replies: 2
    Last Post: 03-23-2011, 11:46 AM
  3. Problem with importing IO from java
    By Anandt88 in forum Java Servlet
    Replies: 2
    Last Post: 06-22-2010, 01:00 PM
  4. Importing a .java
    By Kaito in forum New To Java
    Replies: 5
    Last Post: 09-24-2009, 02:33 AM
  5. Importing Picture into Java Code
    By swimmy101 in forum New To Java
    Replies: 1
    Last Post: 02-12-2009, 09:48 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •