-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added files for Life Insurance needs Calculator
- Loading branch information
Showing
5 changed files
with
122 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,11 @@ | ||
# Web Life Insurance Needs Calculator | ||
|
||
![Calc-Image](image.png) | ||
|
||
This is a web-based life insurance needs calculator that helps users determine how much life insurance they need based on their annual income, years of support needed, outstanding debts, funeral costs, savings, and investments. | ||
|
||
## Features | ||
|
||
- Input fields for annual income, years of support needed, outstanding debts, funeral costs, savings, and investments. | ||
- Calculation of the total life insurance needed based on the provided inputs. | ||
- Clear and intuitive user interface. |
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,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Life Insurance Needs Calculator</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Life Insurance Needs Calculator</h1> | ||
<form id="insuranceForm"> | ||
<label for="annualIncome">Annual Income ($):</label> | ||
<input type="number" id="annualIncome" required> | ||
|
||
<label for="yearsSupport">Years of Support Needed:</label> | ||
<input type="number" id="yearsSupport" required> | ||
|
||
<label for="outstandingDebts">Outstanding Debts ($):</label> | ||
<input type="number" id="outstandingDebts" required> | ||
|
||
<label for="funeralCosts">Funeral Costs ($):</label> | ||
<input type="number" id="funeralCosts" required> | ||
|
||
<label for="savings">Savings and Investments ($):</label> | ||
<input type="number" id="savings" required> | ||
|
||
<button type="button" onclick="calculateInsurance()">Calculate</button> | ||
</form> | ||
<div id="result"></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,19 @@ | ||
function calculateInsurance() { | ||
const annualIncome = parseFloat(document.getElementById('annualIncome').value); | ||
const yearsSupport = parseFloat(document.getElementById('yearsSupport').value); | ||
const outstandingDebts = parseFloat(document.getElementById('outstandingDebts').value); | ||
const funeralCosts = parseFloat(document.getElementById('funeralCosts').value); | ||
const savings = parseFloat(document.getElementById('savings').value); | ||
|
||
if (isNaN(annualIncome) || isNaN(yearsSupport) || isNaN(outstandingDebts) || isNaN(funeralCosts) || isNaN(savings)) { | ||
alert('Please enter valid numbers in all fields.'); | ||
return; | ||
} | ||
|
||
const incomeNeeds = annualIncome * yearsSupport; | ||
const totalNeeds = incomeNeeds + outstandingDebts + funeralCosts; | ||
const insuranceNeeds = totalNeeds - savings; | ||
|
||
document.getElementById('result').textContent = | ||
`You need approximately $${insuranceNeeds.toFixed(2)} in life insurance.`; | ||
} |
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,58 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
.container { | ||
background-color: #fff; | ||
padding: 20px; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
width: 100%; | ||
max-width: 500px; | ||
box-sizing: border-box; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
margin-bottom: 20px; | ||
} | ||
|
||
label { | ||
display: block; | ||
margin-bottom: 5px; | ||
} | ||
|
||
input { | ||
width: calc(100% - 20px); | ||
padding: 10px; | ||
margin-bottom: 20px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
box-sizing: border-box; | ||
} | ||
|
||
button { | ||
width: 100%; | ||
padding: 10px; | ||
background-color: #007bff; | ||
color: #fff; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
text-align: center; | ||
font-size: 1.2em; | ||
} |