diff --git a/Calculators/Stress-Strain-Calculator/README.md b/Calculators/Stress-Strain-Calculator/README.md new file mode 100644 index 000000000..bfaffeed1 --- /dev/null +++ b/Calculators/Stress-Strain-Calculator/README.md @@ -0,0 +1,15 @@ +#

Stress Strain Calculator

+ +## Description :- + +The Stress and Strain Calculator is a web-based tool designed to assist users in computing stress and strain values based on input parameters related to a material's mechanical behavior. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Screenshots :- + +![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/af3af44f-77e8-43d6-8b59-72ae0c32156b) diff --git a/Calculators/Stress-Strain-Calculator/index.css b/Calculators/Stress-Strain-Calculator/index.css new file mode 100644 index 000000000..1b6d726d3 --- /dev/null +++ b/Calculators/Stress-Strain-Calculator/index.css @@ -0,0 +1,80 @@ +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #f5f9fc; +} + +.container { + max-width: 600px; + width: 100%; + padding: 20px; + border: 2px solid #00274c; + border-radius: 10px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); + animation: fadeIn 0.8s ease; +} + +@keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +h1 { + text-align: center; + color: #00274c; +} + +form { + margin-top: 20px; +} + +label { + display: block; + margin-bottom: 10px; + color: #00274c; +} + +input { + width: 100%; + padding: 12px; + margin-bottom: 20px; + box-sizing: border-box; + border: 1px solid #dcdcdc; + border-radius: 4px; +} + +button { + background-color: #005cbf; + color: #fff; + border: none; + padding: 12px 24px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 18px; + cursor: pointer; + border-radius: 4px; + transition: background-color 0.3s ease; +} + +button:hover { + background-color: #003366; +} +#results { + opacity: 0; + transition: opacity 0.8s ease; + display: none; /* Added to hide initially */ +} + +#results.show { + opacity: 1; + display: block; diff --git a/Calculators/Stress-Strain-Calculator/index.html b/Calculators/Stress-Strain-Calculator/index.html new file mode 100644 index 000000000..79edf00d7 --- /dev/null +++ b/Calculators/Stress-Strain-Calculator/index.html @@ -0,0 +1,37 @@ + + + + + + Stress and Strain Calculator + + + +
+

Stress and Strain Calculator

+
+ + + + + + + + + + + + + +
+ + +
+ + + + diff --git a/Calculators/Stress-Strain-Calculator/index.js b/Calculators/Stress-Strain-Calculator/index.js new file mode 100644 index 000000000..83e2de8df --- /dev/null +++ b/Calculators/Stress-Strain-Calculator/index.js @@ -0,0 +1,32 @@ +function calculate() { + + const forceInput = document.getElementById('force'); + const areaInput = document.getElementById('area'); + const originalLengthInput = document.getElementById('originalLength'); + const deformedLengthInput = document.getElementById('deformedLength'); + + if (!forceInput.value || !areaInput.value || !originalLengthInput.value || !deformedLengthInput.value) { + alert('Please enter all inputs to calculate.'); + return; + } + + const force = parseFloat(forceInput.value); + const area = parseFloat(areaInput.value); + const originalLength = parseFloat(originalLengthInput.value); + const deformedLength = parseFloat(deformedLengthInput.value); + + if (isNaN(force) || isNaN(area) || isNaN(originalLength) || isNaN(deformedLength)) { + alert('Please enter valid numeric inputs.'); + return; + } + + const stress = force / area; + const strain = (deformedLength - originalLength) / originalLength; + + document.getElementById('stressResult').textContent = `Stress: ${stress.toFixed(2)} N/m^2 (Pa)`; + document.getElementById('strainResult').textContent = `Strain: ${strain.toFixed(2)}`; + + const resultsContainer = document.getElementById('results'); + resultsContainer.classList.remove('hidden'); + resultsContainer.classList.add('show'); +} diff --git a/index.html b/index.html index cbc4907d1..57e30865b 100644 --- a/index.html +++ b/index.html @@ -1765,6 +1765,20 @@

Calculates the Probability of different events.

+
+
+

Stress Strain Calculator

+

Compute stress and strain using force, area, and length inputs.

+ +
+