# Thread: Importing Math fomula to java HELP!!

1. Member
Join Date
Sep 2014
Posts
1
Rep Power
0

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

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

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

## Re: Importing Math fomula to java HELP!!

Originally Posted by langdonh
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. Just a guy
Join Date
Jun 2013
Location
Netherlands
Posts
5,114
Rep Power
13

## Re: Importing Math fomula to java HELP!!

Originally Posted by JosAH
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 ;)