emi calculator , SIP-Mutual fund calculator -calculator and html code
code 1 for EMI calculator
<html>
<head>
<title>EMI Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-weight: bold;
}
.form-group input[type="text"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.form-group input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
#result {
text-align: center;
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>EMI Calculator</h1>
<form id="calculatorForm">
<div class="form-group">
<label for="loanAmount">Loan Amount:</label>
<input id="loanAmount" placeholder="Enter loan amount" required="" type="text" />
</div>
<div class="form-group">
<label for="interestRate">Interest Rate (% per annum):</label>
<input id="interestRate" placeholder="Enter interest rate" required="" type="text" />
</div>
<div class="form-group">
<label for="loanTenure">Loan Tenure (in months):</label>
<input id="loanTenure" placeholder="Enter loan tenure in months" required="" type="text" />
</div>
<div class="form-group">
<input id="calculateBtn" type="submit" value="Calculate" />
</div>
</form>
<div id="result"></div>
</div>
<script>
document.getElementById('calculatorForm').addEventListener('submit', function (event) {
event.preventDefault();
calculateEMI();
});
function calculateEMI() {
var loanAmount = parseFloat(document.getElementById('loanAmount').value);
var interestRate = parseFloat(document.getElementById('interestRate').value);
var loanTenure = parseFloat(document.getElementById('loanTenure').value);
var monthlyInterestRate = interestRate / 12 / 100;
var numPayments = loanTenure;
var denominator = Math.pow(1 + monthlyInterestRate, numPayments) - 1;
var emi = (loanAmount * monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numPayments)) / denominator;
var resultElement = document.getElementById('result');
resultElement.innerHTML = "EMI: $" + emi.toFixed(2);
}
</script>
</body>
</html>
Code 2 for SIP Return Caculator
<html>
<head>
<title>SIP Return Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-weight: bold;
}
.form-group input[type="text"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.form-group input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
#result {
text-align: center;
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>SIP Return Calculator</h1>
<form id="calculatorForm">
<div class="form-group">
<label for="monthlyInvestment">Monthly Investment Amount:</label>
<input id="monthlyInvestment" placeholder="Enter monthly investment amount" required="" type="text" />
</div>
<div class="form-group">
<label for="annualReturn">Annual Return Rate (%):</label>
<input id="annualReturn" placeholder="Enter annual return rate" required="" type="text" />
</div>
<div class="form-group">
<label for="investmentDuration">Investment Duration (Months):</label>
<input id="investmentDuration" placeholder="Enter investment duration in months" required="" type="text" />
</div>
<div class="form-group">
<input id="calculateBtn" type="submit" value="Calculate" />
</div>
</form>
<div id="result"></div>
</div>
<script>
document.getElementById('calculatorForm').addEventListener('submit', function (event) {
event.preventDefault();
calculateReturns();
});
function calculateReturns() {
var monthlyInvestment = parseFloat(document.getElementById('monthlyInvestment').value);
var annualReturn = parseFloat(document.getElementById('annualReturn').value);
var investmentDuration = parseFloat(document.getElementById('investmentDuration').value);
var totalInvestment = monthlyInvestment * investmentDuration;
var futureValue = 0;
for (var i = 1; i <= investmentDuration; i++) {
futureValue += monthlyInvestment;
futureValue *= (1 + (annualReturn / 100) / 12);
}
var resultElement = document.getElementById('result');
resultElement.innerHTML = "Total Investment: $" + totalInvestment.toFixed(2) + "<br>Future Value: $" + futureValue.toFixed(2);
}
</script>
</body>
</html>
Code 3 Mutual Fund Lumpsum Return Calculator
<html>
<head>
<title>Mutual Fund Return Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-weight: bold;
}
.form-group input[type="text"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.form-group input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
#result {
text-align: center;
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>Mutual Fund Return Calculator</h1>
<form id="calculatorForm">
<div class="form-group">
<label for="initialInvestment">Initial Investment Amount:</label>
<input id="initialInvestment" placeholder="Enter initial investment amount" required="" type="text" />
</div>
<div class="form-group">
<label for="annualReturn">Annual Return Rate (%):</label>
<input id="annualReturn" placeholder="Enter annual return rate" required="" type="text" />
</div>
<div class="form-group">
<label for="investmentDuration">Investment Duration (Years):</label>
<input id="investmentDuration" placeholder="Enter investment duration" required="" type="text" />
</div>
<div class="form-group">
<input id="calculateBtn" type="submit" value="Calculate" />
</div>
</form>
<div id="result"></div>
</div>
<script>
document.getElementById('calculatorForm').addEventListener('submit', function (event) {
event.preventDefault();
calculateReturns();
});
function calculateReturns() {
var initialInvestment = parseFloat(document.getElementById('initialInvestment').value);
var annualReturn = parseFloat(document.getElementById('annualReturn').value);
var investmentDuration = parseFloat(document.getElementById('investmentDuration').value);
var futureValue = initialInvestment * Math.pow(1 + (annualReturn / 100), investmentDuration);
var resultElement = document.getElementById('result');
resultElement.innerHTML = "Future Value: $" + futureValue.toFixed(2);
}
</script>
</body>
</html>
Comments
Post a Comment