-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1876 from Saipradyumnagoud/master
Added Blood Pressure Caluclator
- Loading branch information
Showing
4 changed files
with
131 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,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>BP Calculator</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Blood Pressure Calculator</h1> | ||
<form id="bp-form"> | ||
<label for="systolic">Systolic (mmHg):</label> | ||
<input type="number" id="systolic" name="systolic" required> | ||
|
||
<label for="diastolic">Diastolic (mmHg):</label> | ||
<input type="number" id="diastolic" name="diastolic" required> | ||
|
||
<button type="button" onclick="calculateBP()">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,22 @@ | ||
{ | ||
"name": "Blood Pressure Calculator", | ||
"short_name": "BP Calculator", | ||
"description": "A simple Blood Pressure Calculator.", | ||
"start_url": "./index.html", | ||
"display": "standalone", | ||
"background_color": "#f2f2f2", | ||
"theme_color": "#007bff", | ||
"icons": [ | ||
{ | ||
"src": "icons/icon-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "icons/icon-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
] | ||
} | ||
|
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,25 @@ | ||
function calculateBP() { | ||
const systolic = parseInt(document.getElementById('systolic').value); | ||
const diastolic = parseInt(document.getElementById('diastolic').value); | ||
let resultText = ''; | ||
|
||
if (systolic && diastolic) { | ||
if (systolic < 120 && diastolic < 80) { | ||
resultText = 'Normal Blood Pressure'; | ||
} else if (systolic < 130 && diastolic < 80) { | ||
resultText = 'Elevated Blood Pressure'; | ||
} else if (systolic < 140 || diastolic < 90) { | ||
resultText = 'Hypertension Stage 1'; | ||
} else if (systolic >= 140 || diastolic >= 90) { | ||
resultText = 'Hypertension Stage 2'; | ||
} else if (systolic > 180 || diastolic > 120) { | ||
resultText = 'Hypertensive Crisis (Consult your doctor immediately)'; | ||
} else { | ||
resultText = 'Invalid Input'; | ||
} | ||
} else { | ||
resultText = 'Please enter both systolic and diastolic values.'; | ||
} | ||
|
||
document.getElementById('result').innerText = resultText; | ||
} |
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,59 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f9; | ||
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); | ||
text-align: center; | ||
} | ||
|
||
h1 { | ||
margin-bottom: 20px; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
label { | ||
margin: 10px 0 5px; | ||
} | ||
|
||
input { | ||
padding: 10px; | ||
margin-bottom: 20px; | ||
width: 200px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
background-color: #007bff; | ||
color: #fff; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
font-size: 1.2em; | ||
color: #333; | ||
} | ||
|