export default class Mortgage { constructor(principal, years, rate) { this.principal = principal; this.years = years; this.rate = rate; } get monthlyPayment() { let monthlyRate = this.rate / 100 / 12; return this.principal * monthlyRate / (1 - (Math.pow(1/(1 + monthlyRate), this.years * 12))); } get amortization() { let monthlyPayment = this.monthlyPayment; let monthlyRate = this.rate / 100 / 12; let balance = this.principal; let amortization = []; for (let y=0; y