Skip to content

Commit

Permalink
Added FD Calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
AsmitaMishra24 committed Aug 9, 2024
1 parent 75bc95a commit 4832980
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
27 changes: 27 additions & 0 deletions tools/FDCalculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('calculateBtn2').addEventListener('click', function() {
let principal = parseFloat(document.getElementById('principal').value);
let rate = parseFloat(document.getElementById('rate').value);
let years = parseInt(document.getElementById('years1').value);


if (isNaN(principal) || isNaN(rate) || isNaN(years) || principal <= 0 || rate <= 0 || years <= 0) {
alert('Please enter valid values.');
return;
}

let maturityAmount = principal * Math.pow((1 + rate / 100), years);
let interestEarned = maturityAmount - principal;

document.getElementById('interestEarned').textContent = '₹' + interestEarned.toFixed(2);
document.getElementById('maturityAmount').textContent = '₹' + maturityAmount.toFixed(2);
});

document.getElementById('clearBtn1').addEventListener('click', function() {
document.getElementById('principal').value = '';
document.getElementById('rate').value = '';
document.getElementById('years1').value = '';
document.getElementById('interestEarned').textContent = '';
document.getElementById('maturityAmount').textContent = '';
});
});
59 changes: 58 additions & 1 deletion tools/sip.html
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@ <h5>Result:</h5>

<!-- GDP calucltor end here -->

<!--SWP Calculator Start-->
<script src="SWPCalculator.js" defer></script>

<div class="header" style="padding-top: 100px;">
Expand Down Expand Up @@ -1055,7 +1056,8 @@ <h5>Result:</h5>
</div>
</div>
</div>

<!--SWP Calculator End-->

<!-- credit card payoff calculator starts here -->
<script src="creditcardpayoff.js" defer></script>

Expand Down Expand Up @@ -1144,6 +1146,61 @@ <h5>Result:</h5>
<script src="../tools/Billsplit.js"></script>

<!-- Bill split calculator end -->

<!--FD Calculator Start-->
<script src="FDCalculator.js" defer></script>

<div class="header" style="padding-top: 100px;">
<h3 class="text-center mb-4">Fixed Deposit Calculator</h3>
<p class="cal-content">The FD(Fixed Deposit) Calculator helps compute the maturity amount and interest earned on fixed deposits based on the principal, interest rate, and duration.</p>
<div class="know-more">
<button class="know-more-btn">Know More</button>
<div class="know-more-content">
<h6 style="text-align: left; margin: 2% 16%; padding-left: 5px;">Here's how it works:</h6>
<ol type="1" style="font-size: 1rem; text-align: left; margin-left: 17%; margin-bottom: 2rem;">
<li><b>Principal Amount (₹)</b>: Enter your principal amount.</li>
<li><b>Annual Interest Rate (%)</b>: Enter your annual interest rate.</li>
<li><b>Total Period (in years)</b>: Enter your total period of investment in years.</li>
<li><b>Total Interest Earned</b>: Analyzes and provides the total interest earned on your investment.</li>
<li><b>Total Maturity Amount</b>: Analyzes and provides total maturity amount.</li>
</ol>
</div>
</div>
</div>

<div class="page-container shadow p-5 mb-5 bg-white rounded mt-5" id="SWPCalculator">
<div class="row">
<div class="col-md-6 offset-md-3">
<form id="fixed-deposit-calculator" style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<fieldset>
<div class="form-group">
<label for="principal">Principal Amount (₹):</label>
<input type="number" id="principal" placeholder="Enter Principal Amount" required>
</div>
<div class="form-group">
<label for="rate">Annual Interest Rate (%):</label>
<input type="number" id="rate" step="0.01" placeholder="Enter Annual Interest Rate" required>
</div>
<div class="form-group">
<label for="years">Time Period (in years):</label>
<input type="number" id="years1" placeholder="Enter Time Period" required>
</div>
<div class="btn-calculate">
<button id="calculateBtn2" type="button" class="btn btn-calculate">Calculate</button>
<button id="clearBtn1" type="button" class="btn btn-clear"><p class="btn-text">Clear</p></button>
</div>
</fieldset>
</form>
<div id="result-fd" class="mt-3">
<h5>Result:</h5>
<p>Total Interest Earned: <span id="interestEarned"></span></p>
<p>Total Maturity Amount: <span id="maturityAmount"></span></p>
</div>
</div>
</div>
</div>
<!--FD Calculator End-->

</body>

<!-- Timed popup that will appear after succesful submission of feebback form! -->
Expand Down

0 comments on commit 4832980

Please sign in to comment.