Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Credit Card Payoff Calculator #611

Merged
merged 7 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Calculators/Credit-Card-Payoff-Calculator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# <p align="center">Credit Card Payoff Calculator</p>

<p> This is a credit card payoff calculator that helps you determine how long it will take to pay off your credit card debt, given your current balance, interest rate, and monthly payment. It can also help you calculate how much interest you will pay over the life of the loan. <p>

## How to use the calculator:

1) Enter your current credit card balance in the "Enter Credit Card Balance" field.
2) Enter your annual percentage rate (APR) in the "Enter Annual Percentage Rate(APR)" field.
3) Enter your monthly payment in the "Enter Monthly Payment" field.
4) Click the "Calculate" button.

### The calculator will display the following results:

The number of years and months it will take to pay off your credit card debt.

## Benefits of using the credit card payoff calculator:

It can help you understand how much debt you really have.
It can help you create a plan to pay off your debt faster.
It can help you save money on interest.

## Screenshots:

![Screenshot](image.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Calculators/Credit-Card-Payoff-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Credit Card Payoff Calculator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Credit Card Payoff Calculator</h1>
<label for="balance">Enter Credit Card Balance:</label>
<input type="number" id="balance" placeholder="Enter balance (in ₹)">

<label for="apr">Enter Annual Percentage Rate(APR):</label>
<input type="number" id="apr" placeholder="Enter APR (in %)">

<label for="monthly-payment">Enter Monthly Payment:</label>
<input type="number" id="monthly-payment" placeholder="Enter monthly payment (in ₹)">

<button onclick="calculate()">Calculate</button>
<button onclick="reset()">Reset</button>

<div id="result"></div>
</div>
<script src="script.js"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions Calculators/Credit-Card-Payoff-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function calculate() {
var balance = parseFloat(document.getElementById('balance').value);
var apr = parseFloat(document.getElementById('apr').value);
var monthlyPayment = parseFloat(document.getElementById('monthly-payment').value);

var monthlyInterestRate = (apr / 100) / 12;
var months = Math.log(monthlyPayment / (monthlyPayment - balance * monthlyInterestRate)) / Math.log(1 + monthlyInterestRate);

if (isFinite(months)) {
var years = Math.floor(months / 12);
var remainingMonths = Math.ceil(months % 12);
var result = `It will take ${years} years and ${remainingMonths} months to pay off the credit card.`;
} else {
var result = 'Invalid input. Please check your numbers.';
}

document.getElementById('result').innerHTML = result;
}

function reset() {
document.getElementById('balance').value = '';
document.getElementById('apr').value = '';
document.getElementById('monthly-payment').value = '';
document.getElementById('result').innerHTML = '';
}
57 changes: 57 additions & 0 deletions Calculators/Credit-Card-Payoff-Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
body {
font-family: Arial, sans-serif;
/* background-color: #f4f4f4; */
background: linear-gradient(90deg, #9AD0C2, #2D9596);
margin: 0;
padding: 0;
}

.container {
max-width: 600px;
margin: 100px auto;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1),
0 0 20px rgba(0, 0, 0, 0.1),
0 0 40px rgba(0, 0, 0, 0.1);
}

h1 {
text-align: center;
margin-bottom: 20px;
}

label {
display: block;
margin-bottom: 8px;
}

input {
width: 96%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
}

button {
width: 100%;
padding: 10px;
background-color: #265073;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s ease;
margin-bottom: 10px;
}

button:hover {
background-color: #12372A;
}

#result {
margin-top: 10px;
font-weight: bold;
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,20 @@ <h3>Calculates the linear density of the yarn from unit system to another.</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Credit Card Payoff Calculator</h2>
<h3>Calculates the time in which you can payoff your Credits.</h3>
<div class="card-footer">
<a href="./Calculators/Credit-Card-Payoff-Calculator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Credit-Card-Payoff-Calculator" title="Source Code" target="_blank">
<img src="./assets/images/github.png" alt="Source Code"></img>
</a>
</div>
</div>
</div>
</div>

<!-- Calculator Section Ends Here -->
Expand Down