diff --git a/code/module-03/m03-end/build/module03.js b/code/module-03/m03-end/build/module03.js index 2472063..400f81a 100644 --- a/code/module-03/m03-end/build/module03.js +++ b/code/module-03/m03-end/build/module03.js @@ -13,7 +13,7 @@ function intOnlyLoan(loanTerms) { // Calculates the monthly payment of an interest only loan let intr = loanTerms.interestRate / 1200; // Calculates the Monthly Interest Rate of the loan let pmt; - pmt = loanTerms.principle * intr; + pmt = loanTerms.principal * intr; return 'The interest only loan payment is ' + pmt.toFixed(2); } /* TODO: Update the convLoan function, this time replacing the three parameters with an @@ -22,10 +22,10 @@ function convLoan(loanTerms) { // Calculates the monthly payment of a conventional loan let intr = loanTerms.interestRate / 1200; // Calculates the Monthly Interest Rate of the loan let pmt; - pmt = loanTerms.principle * intr / (1 - (Math.pow(1 / (1 + intr), loanTerms.numMonths))); + pmt = loanTerms.principal * intr / (1 - (Math.pow(1 / (1 + intr), loanTerms.numMonths))); return 'The conventional loan payment is ' + pmt.toFixed(2); } -let loan1 = intOnlyLoan({ principle: 30000, interestRate: 5 }); -let loan2 = convLoan({ principle: 30000, interestRate: 5, numMonths: 180 }); +let loan1 = intOnlyLoan({ principal: 30000, interestRate: 5 }); +let loan2 = convLoan({ principal: 30000, interestRate: 5, numMonths: 180 }); console.log(loan1); //* Returns "The interest only loan payment is 125.00" console.log(loan2); //* Returns "The conventional loan payment is 237.24" diff --git a/code/module-03/m03-end/module03.ts b/code/module-03/m03-end/module03.ts index 29e5214..3c31f69 100644 --- a/code/module-03/m03-end/module03.ts +++ b/code/module-03/m03-end/module03.ts @@ -5,7 +5,7 @@ TODO: Declare the Loan interface. */ interface Loan { - principle: number, + principal: number, interestRate: number //* Interest rate percentage (eg. 14 is 14%) } @@ -21,7 +21,7 @@ function calculateInterestOnlyLoanPayment(loanTerms: Loan): string { // Calculates the monthly payment of an interest only loan let interest: number = loanTerms.interestRate / 1200; // Calculates the Monthly Interest Rate of the loan let payment: number; - payment = loanTerms.principle * interest; + payment = loanTerms.principal * interest; return 'The interest only loan payment is ' + payment.toFixed(2); } @@ -31,12 +31,12 @@ function calculateConventionalLoanPayment(loanTerms: ConventionalLoan): string { // Calculates the monthly payment of a conventional loan let interest: number = loanTerms.interestRate / 1200; // Calculates the Monthly Interest Rate of the loan let payment: number; - payment = loanTerms.principle * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); + payment = loanTerms.principal * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); return 'The conventional loan payment is ' + payment.toFixed(2); } -let interestOnlyPayment = calculateInterestOnlyLoanPayment({principle: 30000, interestRate: 5}); -let conventionalPayment = calculateConventionalLoanPayment({principle: 30000, interestRate: 5, months: 180}); +let interestOnlyPayment = calculateInterestOnlyLoanPayment({principal: 30000, interestRate: 5}); +let conventionalPayment = calculateConventionalLoanPayment({principal: 30000, interestRate: 5, months: 180}); console.log(interestOnlyPayment); //* Returns "The interest only loan payment is 125.00" console.log(conventionalPayment); //* Returns "The conventional loan payment is 237.24" diff --git a/code/module-03/m03-start/module03.ts b/code/module-03/m03-start/module03.ts index 5640072..cae443d 100644 --- a/code/module-03/m03-start/module03.ts +++ b/code/module-03/m03-start/module03.ts @@ -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); } diff --git a/code/module-04/m04-end/build/module04.js b/code/module-04/m04-end/build/module04.js index ffc492d..0622ec5 100644 --- a/code/module-04/m04-end/build/module04.js +++ b/code/module-04/m04-end/build/module04.js @@ -64,11 +64,11 @@ console.log(myArray2); TODO: Convert the LoanCalc function to TypeScript with strongly typed parameters, variables, and return types. Make the numMonths parameter optional but assign it a default value of 12 months if omitted. */ -function LoanCalc(principle, interestRate, numMonths = 12) { +function LoanCalc(principal, interestRate, numMonths = 12) { let intr = interestRate / 1200; // Calculates the monthly interest rate let pmt; Number; - pmt = principle * intr / (1 - (Math.pow(1 / (1 + intr), numMonths))); + pmt = principal * intr / (1 - (Math.pow(1 / (1 + intr), numMonths))); return pmt.toFixed(2); } let myLoan = LoanCalc(1000, 5); diff --git a/code/module-04/m04-end/module04.ts b/code/module-04/m04-end/module04.ts index bbd0542..565f1ce 100644 --- a/code/module-04/m04-end/module04.ts +++ b/code/module-04/m04-end/module04.ts @@ -65,10 +65,10 @@ console.log(myArray2); /* EXERCISE 2 TODO: Update the LoanCalculator function. */ -function loanCalculator (principle: number, interestRate: number, months = 12): string { +function loanCalculator (principal: number, interestRate: number, months = 12): string { let interest: number = interestRate / 1200; // Calculates the monthly interest rate let payment: number; - payment = principle * interest / (1 - (Math.pow(1/(1 + interest), months))); + payment = principal * interest / (1 - (Math.pow(1/(1 + interest), months))); return payment.toFixed(2); } diff --git a/code/module-04/m04-start/module04.ts b/code/module-04/m04-start/module04.ts index 00d4bfc..ea77e6a 100644 --- a/code/module-04/m04-start/module04.ts +++ b/code/module-04/m04-start/module04.ts @@ -62,9 +62,9 @@ let myArray2 = buildArray(8, 'descending'); /* EXERCISE 2 TODO: Update the LoanCalculator function. */ -function loanCalculator (principle, interestRate, months) { +function loanCalculator (principal, interestRate, months) { let interest = interestRate / 1200; // Calculates the monthly interest rate let payment; - payment = principle * interest / (1 - (Math.pow(1/(1 + interest), months))); + payment = principal * interest / (1 - (Math.pow(1/(1 + interest), months))); return payment.toFixed(2); } diff --git a/code/module-07/m07-end/module07_loan-programs.js b/code/module-07/m07-end/module07_loan-programs.js index 1b05716..1abf746 100644 --- a/code/module-07/m07-end/module07_loan-programs.js +++ b/code/module-07/m07-end/module07_loan-programs.js @@ -4,7 +4,7 @@ exports.calculateConventionalLoanPayment = exports.calculateInterestOnlyLoanPaym /* TODO Update the calculateInterestOnlyLoanPayment function. */ function calculateInterestOnlyLoanPayment(loanTerms) { var payment; - payment = loanTerms.principle * calculateInterestRate(loanTerms.interestRate); + payment = loanTerms.principal * calculateInterestRate(loanTerms.interestRate); return 'The interest only loan payment is ' + payment.toFixed(2); } exports.calculateInterestOnlyLoanPayment = calculateInterestOnlyLoanPayment; @@ -12,7 +12,7 @@ exports.calculateInterestOnlyLoanPayment = calculateInterestOnlyLoanPayment; function calculateConventionalLoanPayment(loanTerms) { var interest = calculateInterestRate(loanTerms.interestRate); var payment; - payment = loanTerms.principle * interest / (1 - (Math.pow(1 / (1 + interest), loanTerms.months))); + payment = loanTerms.principal * interest / (1 - (Math.pow(1 / (1 + interest), loanTerms.months))); return 'The conventional loan payment is ' + payment.toFixed(2); } exports.calculateConventionalLoanPayment = calculateConventionalLoanPayment; diff --git a/code/module-07/m07-end/module07_loan-programs.ts b/code/module-07/m07-end/module07_loan-programs.ts index 3d11c93..bb512cd 100644 --- a/code/module-07/m07-end/module07_loan-programs.ts +++ b/code/module-07/m07-end/module07_loan-programs.ts @@ -4,17 +4,17 @@ import * as Loans from './module07_loans.js'; /* TODO Update the calculateInterestOnlyLoanPayment function. */ export function calculateInterestOnlyLoanPayment(loanTerms: Loans.Loan): string { let payment: number; - payment = loanTerms.principle * calculateInterestRate(loanTerms.interestRate); + payment = loanTerms.principal * calculateInterestRate(loanTerms.interestRate); return 'The interest only loan payment is ' + payment.toFixed(2); } /* TODO Update the calculateConventionalLoanPayment function. */ export function calculateConventionalLoanPayment(loanTerms: Loans.ConventionalLoan): string { let interest: number = calculateInterestRate(loanTerms.interestRate); let payment: number; - payment = loanTerms.principle * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); + payment = loanTerms.principal * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); return 'The conventional loan payment is ' + payment.toFixed(2); } function calculateInterestRate (interestRate: number): number { let interest: number = interestRate / 1200; return interest -} \ No newline at end of file +} diff --git a/code/module-07/m07-end/module07_loans.ts b/code/module-07/m07-end/module07_loans.ts index a0132c6..82894f5 100644 --- a/code/module-07/m07-end/module07_loans.ts +++ b/code/module-07/m07-end/module07_loans.ts @@ -1,8 +1,8 @@ /* TODO Update the interface declarations. */ export interface Loan { - principle: number, + principal: number, interestRate: number //* Interest rate percentage (eg. 14 is 14%) } export interface ConventionalLoan extends Loan { months: number //* Total number of months -} \ No newline at end of file +} diff --git a/code/module-07/m07-end/module07_main.js b/code/module-07/m07-end/module07_main.js index bce65d5..e36bd2a 100644 --- a/code/module-07/m07-end/module07_main.js +++ b/code/module-07/m07-end/module07_main.js @@ -5,7 +5,7 @@ exports.__esModule = true; /* TODO Add the import statement. */ var LoanPrograms = require("./module07_loan-programs.js"); /* TODO Update the function calls. */ -var interestOnlyPayment = LoanPrograms.calculateInterestOnlyLoanPayment({ principle: 30000, interestRate: 5 }); -var conventionalLoanPayment = LoanPrograms.calculateConventionalLoanPayment({ principle: 30000, interestRate: 5, months: 180 }); +var interestOnlyPayment = LoanPrograms.calculateInterestOnlyLoanPayment({ principal: 30000, interestRate: 5 }); +var conventionalLoanPayment = LoanPrograms.calculateConventionalLoanPayment({ principal: 30000, interestRate: 5, months: 180 }); console.log(interestOnlyPayment); //* Returns "The interest only loan payment is 125.00" console.log(conventionalLoanPayment); //* Returns "The conventional loan payment is 237.24" diff --git a/code/module-07/m07-end/module07_main.ts b/code/module-07/m07-end/module07_main.ts index f6d3e2b..b75be7e 100644 --- a/code/module-07/m07-end/module07_main.ts +++ b/code/module-07/m07-end/module07_main.ts @@ -5,7 +5,7 @@ import * as LoanPrograms from './module07_loan-programs.js'; /* TODO Update the function calls. */ -let interestOnlyPayment = LoanPrograms.calculateInterestOnlyLoanPayment({principle: 30000, interestRate: 5}); -let conventionalLoanPayment = LoanPrograms.calculateConventionalLoanPayment({principle: 30000, interestRate: 5, months: 180}); +let interestOnlyPayment = LoanPrograms.calculateInterestOnlyLoanPayment({principal: 30000, interestRate: 5}); +let conventionalLoanPayment = LoanPrograms.calculateConventionalLoanPayment({principal: 30000, interestRate: 5, months: 180}); console.log(interestOnlyPayment); //* Returns "The interest only loan payment is 125.00" console.log(conventionalLoanPayment); //* Returns "The conventional loan payment is 237.24" diff --git a/code/module-07/m07-start/module07_loan-programs.ts b/code/module-07/m07-start/module07_loan-programs.ts index a93c75a..f36539f 100644 --- a/code/module-07/m07-start/module07_loan-programs.ts +++ b/code/module-07/m07-start/module07_loan-programs.ts @@ -3,17 +3,17 @@ /* TODO Update the calculateInterestOnlyLoanPayment function. */ function calculateInterestOnlyLoanPayment(loanTerms: Loan): string { let payment: number; - payment = loanTerms.principle * calculateInterestRate(loanTerms.interestRate); + payment = loanTerms.principal * calculateInterestRate(loanTerms.interestRate); return 'The interest only loan payment is ' + payment.toFixed(2); } /* TODO Update the calculateConventionalLoanPayment function. */ function calculateConventionalLoanPayment(loanTerms: ConventionalLoan): string { let interest: number = calculateInterestRate(loanTerms.interestRate); let payment: number; - payment = loanTerms.principle * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); + payment = loanTerms.principal * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); return 'The conventional loan payment is ' + payment.toFixed(2); } function calculateInterestRate (interestRate: number): number { let interest: number = interestRate / 1200; return interest -} \ No newline at end of file +} diff --git a/code/module-07/m07-start/module07_loans.ts b/code/module-07/m07-start/module07_loans.ts index 3e5933f..9b363ed 100644 --- a/code/module-07/m07-start/module07_loans.ts +++ b/code/module-07/m07-start/module07_loans.ts @@ -1,8 +1,8 @@ /* TODO Update the interface declarations. */ interface Loan { - principle: number, + principal: number, interestRate: number //* Interest rate percentage (eg. 14 is 14%) } interface ConventionalLoan extends Loan { months: number //* Total number of months -} \ No newline at end of file +} diff --git a/code/module-07/m07-start/module07_main.ts b/code/module-07/m07-start/module07_main.ts index 77b3fbf..56b9f73 100644 --- a/code/module-07/m07-start/module07_main.ts +++ b/code/module-07/m07-start/module07_main.ts @@ -4,7 +4,7 @@ /* TODO Add the import statement. */ /* TODO Update the function calls. */ -let interestOnlyPayment = calculateInterestOnlyLoanPayment({principle: 30000, interestRate: 5}); -let conventionalLoanPayment = calculateConventionalLoanPayment({principle: 30000, interestRate: 5, months: 180}); +let interestOnlyPayment = calculateInterestOnlyLoanPayment({principal: 30000, interestRate: 5}); +let conventionalLoanPayment = calculateConventionalLoanPayment({principal: 30000, interestRate: 5, months: 180}); console.log(interestOnlyPayment); //* Returns "The interest only loan payment is 125.00" console.log(conventionalLoanPayment); //* Returns "The conventional loan payment is 237.24" diff --git a/code/module-08/m08-end/module08_loan-programs.ts b/code/module-08/m08-end/module08_loan-programs.ts index 5aad620..ab316d1 100644 --- a/code/module-08/m08-end/module08_loan-programs.ts +++ b/code/module-08/m08-end/module08_loan-programs.ts @@ -4,14 +4,14 @@ namespace LoanPrograms { // Calculates the monthly payment of an interest only loan export function calculateInterestOnlyLoanPayment(loanTerms: Loans.Loan): string { let payment: number; - payment = loanTerms.principle * calculateInterestRate(loanTerms.interestRate); + payment = loanTerms.principal * calculateInterestRate(loanTerms.interestRate); return 'The interest only loan payment is ' + payment.toFixed(2); } // Calculates the monthly payment of a conventional loan export function calculateConventionalLoanPayment(loanTerms: Loans.ConventionalLoan): string { let interest: number = calculateInterestRate(loanTerms.interestRate); let payment: number; - payment = loanTerms.principle * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); + payment = loanTerms.principal * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); return 'The conventional loan payment is ' + payment.toFixed(2); } function calculateInterestRate (interestRate: number): number { diff --git a/code/module-08/m08-end/module08_loans.ts b/code/module-08/m08-end/module08_loans.ts index 5d50e74..4ce4c5f 100644 --- a/code/module-08/m08-end/module08_loans.ts +++ b/code/module-08/m08-end/module08_loans.ts @@ -1,7 +1,7 @@ namespace Loans { export interface Loan { - principle: number, + principal: number, interestRate: number //* Interest rate percentage (eg. 14 is 14%) } export interface ConventionalLoan extends Loan { diff --git a/code/module-08/m08-end/module08_main.ts b/code/module-08/m08-end/module08_main.ts index ab0d125..1ffab16 100644 --- a/code/module-08/m08-end/module08_main.ts +++ b/code/module-08/m08-end/module08_main.ts @@ -10,7 +10,7 @@ /// /* TODO Update the function calls. */ -let interestOnlyPayment = LoanPrograms.calculateInterestOnlyLoanPayment({principle: 30000, interestRate: 5}); -let conventionalLoanPayment = LoanPrograms.calculateConventionalLoanPayment({principle: 30000, interestRate: 5, months: 180}); +let interestOnlyPayment = LoanPrograms.calculateInterestOnlyLoanPayment({principal: 30000, interestRate: 5}); +let conventionalLoanPayment = LoanPrograms.calculateConventionalLoanPayment({principal: 30000, interestRate: 5, months: 180}); console.log(interestOnlyPayment); //* Returns "The interest only loan payment is 125.00" console.log(conventionalLoanPayment); //* Returns "The conventional loan payment is 237.24" diff --git a/code/module-08/m08-start/module08_main.ts b/code/module-08/m08-start/module08_main.ts index ebd70aa..cbc775b 100644 --- a/code/module-08/m08-start/module08_main.ts +++ b/code/module-08/m08-start/module08_main.ts @@ -5,7 +5,7 @@ interface Loan { - principle: number, + principal: number, interestRate: number //* Interest rate percentage (eg. 14 is 14%) } interface ConventionalLoan extends Loan { @@ -18,14 +18,14 @@ interface ConventionalLoan extends Loan { /* TODO Update the calculateInterestOnlyLoanPayment function. */ function calculateInterestOnlyLoanPayment(loanTerms: Loan): string { let payment: number; - payment = loanTerms.principle * calculateInterestRate(loanTerms.interestRate); + payment = loanTerms.principal * calculateInterestRate(loanTerms.interestRate); return 'The interest only loan payment is ' + payment.toFixed(2); } /* TODO Update the calculateConventionalLoanPayment function. */ function calculateConventionalLoanPayment(loanTerms: ConventionalLoan): string { let interest: number = calculateInterestRate(loanTerms.interestRate); let payment: number; - payment = loanTerms.principle * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); + payment = loanTerms.principal * interest / (1 - (Math.pow(1/(1 + interest), loanTerms.months))); return 'The conventional loan payment is ' + payment.toFixed(2); } function calculateInterestRate (interestRate: number): number { @@ -37,7 +37,7 @@ function calculateInterestRate (interestRate: number): number { /* TODO Update the function calls. */ -let interestOnlyPayment = calculateInterestOnlyLoanPayment({principle: 30000, interestRate: 5}); -let conventionalLoanPayment = calculateConventionalLoanPayment({principle: 30000, interestRate: 5, months: 180}); +let interestOnlyPayment = calculateInterestOnlyLoanPayment({principal: 30000, interestRate: 5}); +let conventionalLoanPayment = calculateConventionalLoanPayment({principal: 30000, interestRate: 5, months: 180}); console.log(interestOnlyPayment); //* Returns "The interest only loan payment is 125.00" console.log(conventionalLoanPayment); //* Returns "The conventional loan payment is 237.24"