Calculate the monthly payment:
P <- 60000; r <- 6.5; n <- 10 payment <- format(round((r/(12*100)*P)/(1-(1+r/(12*100))^(-n*12)),2), nsmall=2) print(paste("Your monthly payments will be $", payment, ".", sep=""))
## [1] "Your monthly payments will be $681.29."
Calculate the total interest paid over the course of the loan:
P <- 60000; r <- 6.5; n <- 10 payment <- round((r/(12*100)*P)/(1-(1+r/(12*100))^(-n*12)),2) totalInterestPaid <- format(round(payment*(n*12)-P,2), nsmall=2) print(paste("If you make the normal payments (i.e. you pay no extra), the total interest paid on the loan will be $", totalInterestPaid, ".", sep=""))
## [1] "If you make the normal payments (i.e. you pay no extra), the total interest paid on the loan will be $21754.80."