Car Payment

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Java

jsumabat is trying to pay off his new car, a Toyota Corolla 2011. Write him a program that determines how much money he needs to pay each month to finish paying off his car in m months if the principal amount he owes is p and the rate of interest is r. The monthly payment is calculated using the following formula:
\frac{p\frac{r}{12}}{1-(1+\frac{r}{12})^{-m}}

Input

The first line of input is p (1 \le p \le 1\,000\,000).
The next line is r (0 < r < 1).
The next line is m (1 \le m \le 10\,000).

Output

Rounded to 2 decimals and using double precision floating point math, including trailing zeroes, print the monthly payment jsumabat should pay in order to pay off his car in m months.

Note: Do not use DecimalFormat for this question. Use System.out.printf(). Refer to this documentation)

Sample Input

20000
0.07
48

Sample Output

478.92

Comments

There are no comments at the moment.