Missouri Personal Loan Calculator

By: admin0 comments

 

Monthly Payments:

Payment Without Interest:


Interest Rate Per Month:


Total Interest:

Years
Months

Excellent (850-720)
Good (719-680)
Average (679-640)
Below Average(639-300)

#wholeContainer {
position: absolute;
margin: 0%;
font-family: arial ;
overflow: visible ;
max-height: 100px ;
}

#mainInfoTitle {
color: #6889af;
}

#monthlyPaymentHolder {
font-size: 500%;
}

@media screen and (min-width: 400px) {
#outputDisplayContainer {
display: flex;
justify-content: space-around;
}
#monthlyInterestContainer,
#loanContainer,
#interestContainer {
display: flex;
justify-content: space-between;
}

#minorInfoLine {
border: 1px solid #6889af;
width: 100%;
}

#minorInfoContainer {
margin-right: 5%;
}

#minorInfoTitle {
margin-right: 5%;
}
}

@media screen and (max-width: 300px) {
#outputDisplayContainer {
text-align: center;
overflow-x: visible ;
overflow-y: visible auto;
}

#minorInfoLine {
border: 1px solid #6889af;
width: 50%;
}
}

#minorInfoLine {
border: 1px solid #6889af;
}

#totalInterestHolder,
#monthlyInterestHolder,
#monthlyLoanHolder {
font-size: 120%;
color: #6889af;
}

function submitForm() {
var form = document.getElementsByTagName(“form”)[0];
var button = document.querySelector(“#formSubmitButton”);
button.addEventListener(“click”, function() {
if (form.checkValidity()) {
const loanInfo = createLoanInfoClass();
setPaymentInfo(loanInfo);
} else {
alert(“Please check your input.”);
}
});
}

function createLoanInfoClass() {
var loanAmount = document.querySelector(“#loanPriceInput”).value;
var loanProgram = document.querySelector(“#loanProgramSelection”).value;
var loanTerm = document.querySelector(“#loanTermInput”).value;
var interestRate = document.querySelector(“#interestRateInput”).value / 100;
const loanInfo = new LoanInfo(
loanAmount,
loanTerm,
loanProgram,
interestRate
);
return loanInfo;
}

function setPaymentInfo(loanInfo) {
loanInfo.setMonthlyPayment(“monthlyPaymentHolder”);
loanInfo.setMonthlyInterest(“monthlyInterestHolder”);
loanInfo.setMonthlyLoan(“monthlyLoanHolder”);
loanInfo.setInterestPaid(“totalInterestHolder”);
}

class LoanInfo {
constructor(loanAmount, loanTerm, loanProgram, interestRate) {
this.loanAmount = loanAmount;
this.loanTerm = loanTerm;
this.loanProgram = loanProgram;
this.interestRate = interestRate;
this.monthlyPayment = this.getMonthlyPayment();
this.monthlyInterest = this.getMonthlyInterest();
this.monthlyLoan = this.getMonthlyLoan();
this.interestPaid = this.getInterestPaid();
}

getMonthlyPayment() {
var payment = this.loanAmount / (this.loanTerm * this.loanProgram);
var interest =
(this.interestRate * this.loanAmount) /
(this.loanTerm * this.loanProgram);
return Math.round((payment + interest) * 100) / 100;
}

getMonthlyInterest() {
return (
Math.round(
((this.interestRate * this.loanAmount) /
(this.loanTerm * this.loanProgram)) *
100
) / 100
);
}

getMonthlyLoan() {
return (
Math.round(
(this.loanAmount / (this.loanTerm * this.loanProgram)) * 100
) / 100
);
}

getInterestPaid() {
return Math.round(this.loanAmount * this.interestRate * 100) / 100;
}

setMonthlyPayment(idLocation) {
document.getElementById(idLocation).innerText =
“$” + this.monthlyPayment;
}

setMonthlyInterest(idLocation) {
document.getElementById(idLocation).innerText =
“$” + this.monthlyInterest;
}

setMonthlyLoan(idLocation) {
document.getElementById(idLocation).innerText = “$” + this.monthlyLoan;
}

setInterestPaid(idLocation) {
document.getElementById(idLocation).innerText = “$” + this.interestPaid;
}
}

Related post

Leave A Comment