diff --git a/VehicleLoanCalculator/Johnn222/calculator.css b/VehicleLoanCalculator/Johnn222/calculator.css new file mode 100644 index 000000000..a0862fb5e --- /dev/null +++ b/VehicleLoanCalculator/Johnn222/calculator.css @@ -0,0 +1,53 @@ +body{ + padding:20px; + } + + #loanCalc input{ + padding:10px; + display:block; + } + + + .paymentCalc{ + background-color: #f7f7f7; + border: 1px solid #d3d3d3; + padding: 35px 35px; + overflow: auto; + position: relative; + left: 220; + width:fit-content; + justify-content: center; + } + + .calcBtn{ + display:inline-block; + background:#c62233; + color:#fff; + text-align:center; + padding:10px 20px; + border-radius: 3px; + + } + + #paymentResults{ + display: none; + background:#fff; + padding: 30px 60px 36px 60px; + border:1px solid lightgrey; + margin-top:88px; + } + + .output{ + text-shadow: 2px; + font-weight: bold; + font-size: large; + width: 170; + align-items: flex-end; + text-align: right; + } + + label{ + font-size: medium; + } + + \ No newline at end of file diff --git a/VehicleLoanCalculator/Johnn222/calculator.js b/VehicleLoanCalculator/Johnn222/calculator.js new file mode 100644 index 000000000..4ed821563 --- /dev/null +++ b/VehicleLoanCalculator/Johnn222/calculator.js @@ -0,0 +1,46 @@ +function calculatePayments(){ + var vehiclePrice = document.getElementById('vehiclePrice').value, + loanTerm = document.getElementById('loanTerm').value, + intRate = document.getElementById('intRate').value, + downPayment = document.getElementById('downPayment').value, + tradeValue = document.getElementById('tradeValue').value, + amount = parseInt(vehiclePrice), + months = parseInt(loanTerm), + down = parseInt(downPayment), + trade = parseInt(tradeValue), + totalDown = down + trade + annInterest = parseFloat(intRate), + monInt = annInterest / 1200; + + if(!amount){ + alert('Please add a loan amount'); + return; + } + + if(!months){ + months = 60; + loanTerm = document.getElementById('loanTerm').value = '60'; + } + + if(!downPayment){ + down = 0; + downPayment = document.getElementById('downPayment').value = '0'; + } + + if(!trade){ + trade = 0; + tradeValue = document.getElementById('tradeValue').value = '0'; + } + + if(!annInterest){ + annInterest = 3.25; + intRate = document.getElementById('intRate').value = '3.25'; + } + + + var calc = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount - (totalDown || 0))).toFixed(2); + var total = (calc * months).toFixed(2); + document.getElementById("MonthlyPayment").value = calc; + document.getElementById("TTLPayment").value = total; + + } \ No newline at end of file diff --git a/VehicleLoanCalculator/Johnn222/index.html b/VehicleLoanCalculator/Johnn222/index.html new file mode 100644 index 000000000..f701b7334 --- /dev/null +++ b/VehicleLoanCalculator/Johnn222/index.html @@ -0,0 +1,71 @@ + + + Loan Calculator + + + +
+ +
+
+

Loan Calculator

+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ + + + + + + +
+ + +
+ + +
+
+
+ +
+ + + + + + \ No newline at end of file