 
 extension Mortgage {
   func next(extraPayment: Float) -> MortgagePayment {
-    let requiredPayment = requiredMonthlyPayment()
+    let requiredPayment = requiredMonthlyPayment
     if (requiredPayment > balance) {
       return MortgagePayment(principal: balance, interest: 0)
     }



let mortgage = Mortgage(amount: amount, years: durationInYears, yearlyInterestRate: interestRatePercentage)
let monthlyPayment = mortgage.requiredMonthlyPayment()
print("Your monthly payment will be \(currencyFormatter.string(from: monthlyPayment)) \n")


let totalInterestPaid = mortgage.theoricalTotalInterestPaid()


class Mortgage {
    let yearlyInterestRate: Float
    lazy var monthlyInterestRate: Float =  {
        [unowned self] in
        return self.yearlyInterestRate / 12
    }()
    let years: Int
    lazy var months: Int =  {
        [unowned self] in
        return self.years * 12
    }()
    let amount: Float
    lazy var requiredMonthlyPayment: Float =  {
        [unowned self] in
        let monthlyInterestRate = self.monthlyInterestRate
        let months = self.months
        let amount = self.amount
        //    M = P[i(1+i)^n]/[(1+i)^n -1]
        return (amount * ((monthlyInterestRate * (1 + monthlyInterestRate)^^months) / ((1 + monthlyInterestRate)^^months - 1)))
    }()
    var balance: Float
    var actualInterestPaid: Float

