Thursday, April 17, 2025
Google search engine
HomeEducationHow to create Android APP Using deepseek AI

How to create Android APP Using deepseek AI

Creating a Loan EMI (Equated Monthly Installment) Calculator using HTML, CSS, and JavaScript is a great way to understand how loan repayments work. Below, I’ll guide you through the steps to create a professional-looking EMI calculator. The calculator will take the loan amount, interest rate, and loan tenure as inputs and display the monthly EMI, total interest payable, and the total amount payable.

Please Click Here To Download  Android APP:android app-release

Step 1: HTML Structure

First, let’s create the basic structure of our EMI calculator using HTML.

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Loan EMI Calculator</title>
<link rel=”stylesheet” href=”styles.css”>
</head>
<body>
<div class=”calculator-container”>
<h1>Loan EMI Calculator</h1>
<form id=”emiForm”>
<div class=”input-group”>
<label for=”loanAmount”>Loan Amount (₹)</label>
<input type=”number” id=”loanAmount” required>
</div>
<div class=”input-group”>
<label for=”interestRate”>Interest Rate (% per annum)</label>
<input type=”number” id=”interestRate” required>
</div>
<div class=”input-group”>
<label for=”loanTenure”>Loan Tenure (in years)</label>
<input type=”number” id=”loanTenure” required>
</div>
<button type=”submit”>Calculate EMI</button>
</form>
<div id=”result” class=”result-container”>
<h2>Result</h2>
<p>Monthly EMI: <span id=”monthlyEMI”></span></p>
<p>Total Interest Payable: <span id=”totalInterest”></span></p>
<p>Total Amount Payable: <span id=”totalAmount”></span></p>
<p>Total Months: <span id=”totalMonths”></span></p>
</div>
</div>
<script src=”script.js”></script>
</body>
</html>

Step 2: CSS Styling

Next, let’s style our calculator to make it look professional and user-friendly.

/* styles.css */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.calculator-container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}

h1 {
text-align: center;
color: #333;
}

.input-group {
margin-bottom: 15px;
}

.input-group label {
display: block;
margin-bottom: 5px;
color: #555;
}

.input-group input {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}

button {
width: 100%;
padding: 10px;
background-color: #28a745;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}

button:hover {
background-color: #218838;
}

.result-container {
margin-top: 20px;
padding: 10px;
background-color: #f8f9fa;
border-radius: 4px;
}

.result-container h2 {
margin-top: 0;
color: #333;
}

.result-container p {
margin: 5px 0;
color: #555;
}

Step 3: JavaScript Logic

Finally, let’s add the JavaScript to calculate the EMI, total interest, total amount, and total months.

// script.js
document.getElementById(’emiForm’).addEventListener(‘submit’, function(event) {
event.preventDefault();

// Get input values
const loanAmount = parseFloat(document.getElementById(‘loanAmount’).value);
const interestRate = parseFloat(document.getElementById(‘interestRate’).value);
const loanTenure = parseFloat(document.getElementById(‘loanTenure’).value);

// Calculate monthly interest rate and total number of months
const monthlyInterestRate = (interestRate / 100) / 12;
const totalMonths = loanTenure * 12;

// Calculate EMI
const emi = (loanAmount * monthlyInterestRate * Math.pow(1 + monthlyInterestRate, totalMonths)) / (Math.pow(1 + monthlyInterestRate, totalMonths) – 1);

// Calculate total amount payable and total interest
const totalAmount = emi * totalMonths;
const totalInterest = totalAmount – loanAmount;

// Display results
document.getElementById(‘monthlyEMI’).textContent = `₹${emi.toFixed(2)}`;
document.getElementById(‘totalInterest’).textContent = `₹${totalInterest.toFixed(2)}`;
document.getElementById(‘totalAmount’).textContent = `₹${totalAmount.toFixed(2)}`;
document.getElementById(‘totalMonths’).textContent = totalMonths;
});

Explanation:

  1. HTML Structure: The HTML structure includes a form to input the loan amount, interest rate, and loan tenure. It also includes a section to display the results.
  2. CSS Styling: The CSS styles the calculator to make it visually appealing and user-friendly. It includes styles for the form, buttons, and result display.
  3. JavaScript Logic: The JavaScript calculates the EMI using the formula:EMI=P×r×(1+r)n(1+r)n−1where P is the loan amount, r is the monthly interest rate, and n is the total number of months. It also calculates the total interest and total amount payable.

Final Output:

When you open this in a browser, you’ll see a professional-looking EMI calculator where you can input the loan details and get the monthly EMI, total interest, total amount payable, and the total number of months.

This is a simple yet effective way to create a Loan EMI Calculator using HTML, CSS, and JavaScript. You can further enhance it by adding more features like a pie chart to visualize the interest and principal components, or by adding validation to ensure the inputs are within acceptable ranges.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments