-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Dividend Yield Calculator (#1296)
- Loading branch information
Showing
6 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# <p align="center">Dividend Yield Calculator</p> | ||
|
||
## Description :- | ||
|
||
This calculator effortlessly calculates the % Dividend yield which is used to assess potential income from investments, compare dividend-paying stocks, and make informed investment decisions based on risk and long-term financial goals. | ||
|
||
## Tech Stacks :- | ||
|
||
- HTML | ||
- CSS | ||
- JavaScript | ||
|
||
## Screenshots :- | ||
|
||
![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/81514639-8920-465f-aaa6-0dc1dcbdc3f4) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> | ||
<link rel="stylesheet" href="style.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/> | ||
<title>Dividend Yield Calculator</title> | ||
</head> | ||
<body> | ||
<div class="container animate__animated animate__fadeIn"> | ||
<h1>Dividend Yield Calculator</h1> | ||
<form id="dividendForm" class="animate__animated animate__zoomIn"> | ||
<div class="input-group"> | ||
<label for="annualDividend">Annual Dividend (INR):</label> | ||
<input type="number" id="annualDividend" step="0.01" required> | ||
</div> | ||
<div class="input-group"> | ||
<label for="marketPrice">Current Market Price (INR):</label> | ||
<input type="number" id="marketPrice" step="0.01" required> | ||
</div> | ||
<button type="submit">Calculate</button> | ||
</form> | ||
<div id="result" class="result animate__animated animate__fadeInUp"></div> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
document.getElementById('dividendForm').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
|
||
const annualDividend = parseFloat(document.getElementById('annualDividend').value); | ||
const marketPrice = parseFloat(document.getElementById('marketPrice').value); | ||
|
||
if (isNaN(annualDividend) || isNaN(marketPrice)) { | ||
document.getElementById('result').innerText = "Please enter valid numbers."; | ||
return; | ||
} | ||
|
||
const dividendYield = ((annualDividend / marketPrice) * 100).toFixed(2); | ||
|
||
document.getElementById('result').innerHTML = ` | ||
Dividend Yield: ${dividendYield}% | ||
`; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
body { | ||
font-family: 'Arial', sans-serif; | ||
background-image: url('assets/background.jpg'); | ||
background-size: cover; | ||
background-position: center; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
padding: 20px; | ||
} | ||
|
||
.container { | ||
background: rgba(193, 214, 75, 0.9); | ||
padding: 30px; | ||
border-radius: 15px; | ||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); | ||
text-align: center; | ||
width: 100%; | ||
max-width: 400px; | ||
} | ||
|
||
h1 { | ||
margin-bottom: 20px; | ||
font-size: 1.8rem; | ||
color: #333; | ||
} | ||
|
||
.input-group { | ||
margin-bottom: 20px; | ||
} | ||
|
||
.input-group label { | ||
display: block; | ||
margin-bottom: 5px; | ||
font-size: 1rem; | ||
color: #555; | ||
} | ||
|
||
.input-group input { | ||
width: calc(100% - 20px); | ||
padding: 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
font-size: 1rem; | ||
} | ||
|
||
button { | ||
padding: 12px 25px; | ||
border: none; | ||
border-radius: 5px; | ||
background: #1d1d1c; | ||
color: white; | ||
font-size: 1.1rem; | ||
cursor: pointer; | ||
transition: background 0.3s ease; | ||
} | ||
|
||
button:hover { | ||
background: #e08309; | ||
} | ||
|
||
.result { | ||
margin-top: 20px; | ||
font-size: 1.2rem; | ||
color: #333; | ||
font-weight: bold; | ||
} | ||
|
||
@media (max-width: 768px) { | ||
h1 { | ||
font-size: 1.5rem; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
font-size: 1rem; | ||
} | ||
|
||
.input-group input { | ||
font-size: 0.9rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters