Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/module-03/m03-start/module03.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

/* TODO: Update the calculateInterestOnlyLoanPayment function. */

function calculateInterestOnlyLoanPayment(principle, interestRate) {
function calculateInterestOnlyLoanPayment(principal, interestRate) {
// Calculates the monthly payment of an interest only loan
let interest = interestRate / 1200; // Calculates the Monthly Interest Rate of the loan
let payment;
payment = principle * interest;
payment = principal * interest;
return 'The interest only loan payment is ' + payment.toFixed(2);
}

/* TODO: Update the calculateConventionalLoanPayment function. */

function calculateConventionalLoanPayment(principle, interestRate, months) {
function calculateConventionalLoanPayment(principal, interestRate, months) {
// Calculates the monthly payment of a conventional loan
let interest = interestRate / 1200; // Calculates the Monthly Interest Rate of the loan
let payment;
payment = principle * interest / (1 - (Math.pow(1 / (1 + interest), months)));
payment = principal * interest / (1 - (Math.pow(1 / (1 + interest), months)));
return 'The conventional loan payment is ' + payment.toFixed(2);
}

Expand Down