forked from Rakesh9100/CalcDiverse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Thermal Expansion Calculator (Rakesh9100#1558)
- Loading branch information
Showing
6 changed files
with
142 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">Thermal Expansion Calculator</p> | ||
|
||
## Description :- | ||
|
||
Any material undergoes thermal expansion according to the formula ΔL = αLΔT, where ΔL is the change in length, α is the thermal expansion coefficient, L is the initial length, and ΔT is the temperature change. | ||
|
||
## Tech Stacks :- | ||
|
||
- HTML | ||
- CSS | ||
- JavaScript | ||
|
||
## Screenshots :- | ||
|
||
![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/9efa5d08-f9d9-418e-84e0-7052ac43690c) |
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,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="stylesheet" type="text/css" href="style.css" /> | ||
<title>Thermal Expansion Calculator</title> | ||
</head> | ||
<body> | ||
<h1>Thermal Expansion Calculator</h1> | ||
<div class="calculator-container"> | ||
<div class="input-container"> | ||
<label for="initialLength">Initial Length (metres):</label> | ||
<input type="number" id="initialLength" placeholder="Enter initial length"> | ||
</div> | ||
<div class="input-container"> | ||
<label for="expansionCoefficient">Thermal Expansion Coefficient (α):</label> | ||
<input type="number" id="expansionCoefficient" placeholder="Enter coefficient" step="any"> | ||
</div> | ||
<div class="input-container"> | ||
<label for="temperatureChange">Temperature Change (Kelvin):</label> | ||
<input type="number" id="temperatureChange" placeholder="Enter temperature change"> | ||
</div> | ||
<button onclick="calculateExpansion()">Calculate ΔL</button> | ||
<div class="result-container"> | ||
<p id="result">Result will appear here.</p> | ||
</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,12 @@ | ||
function calculateExpansion() { | ||
const initialLength = document.getElementById('initialLength').value; | ||
const expansionCoefficient = document.getElementById('expansionCoefficient').value; | ||
const temperatureChange = document.getElementById('temperatureChange').value; | ||
|
||
if (initialLength && expansionCoefficient && temperatureChange) { | ||
const deltaL = expansionCoefficient * initialLength * temperatureChange; | ||
document.getElementById('result').innerText = `The change in length (ΔL) is: ${deltaL}m.\n\nThe final length is: ${parseFloat(initialLength) + deltaL}m.`; | ||
} else { | ||
document.getElementById('result').innerText = 'Please fill in all fields.'; | ||
} | ||
} |
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,70 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-image: url(./assets/background.jpg); | ||
background-size: cover; | ||
color: #333; | ||
margin: 5px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: flex-start; | ||
min-height: 0vh; | ||
} | ||
|
||
h1, | ||
h2 { | ||
color: #fff; | ||
background-color: #3498db; | ||
padding: 10px; | ||
border: 2px solid #2980b9; | ||
text-align: center; | ||
width: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
.calculator-container { | ||
background-color: #fff; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | ||
border-radius: 8px; | ||
padding: 20px; | ||
max-width: 400px; | ||
margin: 20px auto; | ||
} | ||
|
||
.input-container { | ||
margin-bottom: 15px; | ||
} | ||
|
||
label { | ||
display: block; | ||
margin-bottom: 5px; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
padding: 10px; | ||
box-sizing: border-box; | ||
} | ||
|
||
button { | ||
background-color: #3498db; | ||
color: #fff; | ||
padding: 10px; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
button:hover { | ||
background-color: #2980b9; | ||
} | ||
|
||
.calculation-container, | ||
.result-container { | ||
background-color: #f1f1f1; | ||
padding: 15px; | ||
border-radius: 5px; | ||
margin-bottom: 15px; | ||
} |
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