diff --git a/Calculators/Real-Estate-Calculator/index.html b/Calculators/Real-Estate-Calculator/index.html index 57eb8edc2..171d97d02 100644 --- a/Calculators/Real-Estate-Calculator/index.html +++ b/Calculators/Real-Estate-Calculator/index.html @@ -13,8 +13,14 @@

Real Estate Calculator

- + + + +
diff --git a/Calculators/Real-Estate-Calculator/script.js b/Calculators/Real-Estate-Calculator/script.js index 7f2347bc3..55d38828b 100644 --- a/Calculators/Real-Estate-Calculator/script.js +++ b/Calculators/Real-Estate-Calculator/script.js @@ -18,8 +18,14 @@ function calculateMortgage() { var monthlyPayment = (loanAmount * monthlyInterestRate) / (1 - Math.pow(1 + monthlyInterestRate, -numberOfPayments)); + var currency = document.getElementById("currency").value; + var currencySymbol = currency === "USD" ? "$" : "₹"; + // Display the result document.getElementById("result").innerHTML = - "Loan Amount: $" + loanAmount.toFixed(2) + "
" + - "Monthly Payment: $" + monthlyPayment.toFixed(2); + "Loan Amount("+currencySymbol+"): " + loanAmount.toFixed(2) + "
" + + "Monthly Payment("+currencySymbol+"): " + monthlyPayment.toFixed(2); } + +// Added an event listener to update results when currency is changed +document.getElementById("currency").addEventListener("change", calculateMortgage); diff --git a/Calculators/Real-Estate-Calculator/style.css b/Calculators/Real-Estate-Calculator/style.css index 7ca92bd72..d54ab01ca 100644 --- a/Calculators/Real-Estate-Calculator/style.css +++ b/Calculators/Real-Estate-Calculator/style.css @@ -8,6 +8,14 @@ body { height: 100vh; } +#currency { + border: 2px solid black; + border-radius: 50px; + width: 65px; + font-size: 12px; + font-weight: bold; +} + .calculator-container { background-color: #fff; padding: 20px; @@ -34,4 +42,4 @@ button:hover { input { padding: 8px; margin: 5px; -} \ No newline at end of file +}