Skip to content

Commit df80357

Browse files
committed
added images
1 parent 2cc9f23 commit df80357

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Loan Calculator/Screenshots/ss1.png

26.8 KB
Loading

Loan Calculator/Screenshots/ss2.png

39 KB
Loading

Loan Calculator/script.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ function calculateLoan(){
44
const interestRate = document.querySelector("#interest").value;
55
const months = document.querySelector("#months").value;
66

7-
const interest =(amount*(interestRate*0.01))/months;
8-
const payment = ((amount/months) + interest).toFixed(2);
7+
const monthlyRate = (interestRate)/(12*100);
8+
const onePlusR = Math.pow(1+monthlyRate, months);
9+
const den = onePlusR - 1;
910

10-
document.querySelector("#payment").innerHTML = `EMI: ₹ ${payment}`
11+
const emi = (amount * monthlyRate * (onePlusR/ den)).toFixed(2);
12+
const totalPay = (emi * months).toFixed(2);
13+
14+
document.querySelector("#payment").innerHTML = `EMI: ₹ ${emi} <br><br> Total Payment: ₹${totalPay}`
1115

1216
}

Loan Calculator/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ body{
55
.container{
66
width: 400px;
77
height: 450px;
8-
background-color: #ff1d58;
8+
background-color: #ff4a7a;
99
position: absolute;
1010
top: 50%;
1111
left: 50%;

0 commit comments

Comments
 (0)