Dwayne often needs to calculate the amount of Emulated Monthly Installment (EMI) that needs to be charged from a particular person. The EMI is calculated according to the following formula:
EMI = Principal loan amount×Rate of interest×(1 + Rate of interest)Tenure of loan in months/((1 + Rate of interest)Tenure of loan in months - 1)
The rate of interest is calculated on a monthly basis. For example, if the rate of interest is 12 % per annum, it is calculated as (12/100)/12.
Dwayne manually calculates the interest rate using a calculator. However, he often commits mistakes in calculating the interest due to the complex formula. Therefore, he asks Elina to build an application that accepts the principal loan amount, rate of interest, and tenure of the loan and calculates the EMI amount. Write the code that Elina should implement to create the application.
Leave a comment