From e13845e9afe14ea932ddb0d9aafb75cdd406fafa Mon Sep 17 00:00:00 2001 From: indrajeetyadav Date: Thu, 1 Aug 2024 01:09:59 +0530 Subject: [PATCH 1/5] discriminant Calculator Added --- Calculators/discriminant/index.html | 32 +++++++++ Calculators/discriminant/script.js | 35 ++++++++++ Calculators/discriminant/style.css | 101 ++++++++++++++++++++++++++++ index.html | 17 +++++ 4 files changed, 185 insertions(+) create mode 100644 Calculators/discriminant/index.html create mode 100644 Calculators/discriminant/script.js create mode 100644 Calculators/discriminant/style.css diff --git a/Calculators/discriminant/index.html b/Calculators/discriminant/index.html new file mode 100644 index 000000000..2b9e55da9 --- /dev/null +++ b/Calculators/discriminant/index.html @@ -0,0 +1,32 @@ + + + + + + + + Discriminant Calculator + + + +
+

DISCRIMINANT CALCULATOR

+ +

Please enter the coefficients a, b and c of a quadratic + equation of the form:
ax² + bx + c = 0

+ +
+ a = + b = + c = +
+
+ +

+

+ + +

+ + + \ No newline at end of file diff --git a/Calculators/discriminant/script.js b/Calculators/discriminant/script.js new file mode 100644 index 000000000..48f04fe75 --- /dev/null +++ b/Calculators/discriminant/script.js @@ -0,0 +1,35 @@ + +'use strict' + +function validate() { + // Get the input values + var a = parseFloat(document.forms["input_form"]["aterm"].value); + var b = parseFloat(document.forms["input_form"]["bterm"].value); + var c = parseFloat(document.forms["input_form"]["cterm"].value); + + var outputText, outputValue; + + // Validate the inputs + if (isNaN(a) || isNaN(b) || isNaN(c)) { + outputText = "All coefficients must be numbers!"; + } else if (a === 0) { + outputText = "a cannot be zero!"; + } else { + // Calculate the discriminant + var discriminant = Math.pow(b, 2) - 4 * a * c; + + outputText = "For the equation " + (a === 1 ? "" : a) + "x\u00B2 + " + (b === 1 ? "" : b) + "x + " + c + " = 0,"; + + if (discriminant > 0) { + outputValue = "The discriminant (D) is " + discriminant + ". There are two distinct real roots."; + } else if (discriminant === 0) { + outputValue = "The discriminant (D) is " + discriminant + ". There is exactly one real root."; + } else { + outputValue = "The discriminant (D) is " + discriminant + ". There are no real roots (complex roots)."; + } + } + + // Output the result + document.getElementById("output_text").innerHTML = outputText; + document.getElementById("outputValue").innerHTML = outputValue; +} \ No newline at end of file diff --git a/Calculators/discriminant/style.css b/Calculators/discriminant/style.css new file mode 100644 index 000000000..427c0ffb6 --- /dev/null +++ b/Calculators/discriminant/style.css @@ -0,0 +1,101 @@ +body { + font-family: 'Roboto', sans-serif; + margin: 0; + padding: 0; + background: linear-gradient(135deg, #3498db, #8e44ad); + background-size: cover; + color: #ecf0f1; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; +} + +.container { + display: flex; + flex-direction: column; + width: 90%; + max-width: 400px; + background-color: rgba(255, 255, 255, 0.9); + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); +} + +h1 { + text-align: center; + color: #2ecc71; + margin-bottom: 20px; +} + +p { + text-align: center; + color: #6b6b6b; + margin: 10px 0; +} + +#equation { + font-size: 1.2rem; + margin-bottom: 20px; +} + +form { + text-align: center; + margin-top: 20px; + margin-bottom: 20px; + color: #6b6b6b; +} + +span { + display: inline-block; + margin: 0 10px; +} + +input { + font-size: 1rem; + padding: 10px; + margin: 0 10px 10px 10px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; + transition: border-color 0.3s ease, box-shadow 0.3s ease; + color: #2c3e50; +} + +input:hover, +input:focus { + border-color: #3498db; +} + +form div { + margin-top: 20px; +} + +button { + background-color: #e74c3c; + color: #ecf0f1; + padding: 12px 24px; + border: none; + border-radius: 4px; + cursor: pointer; + transition: background-color 0.3s ease; + margin: 0 auto; + display: block; +} + +button:hover { + background-color: #c0392b; +} + +#output_text { + margin-top: 20px; + text-align: center; + color: #404040; +} + +#outputValue { + margin-top: 10px; + font-weight: bold; + font-size: 1.2em; + color: #2ecc71; +} \ No newline at end of file diff --git a/index.html b/index.html index 770b7ae8b..3e0d5da67 100644 --- a/index.html +++ b/index.html @@ -1541,6 +1541,23 @@

Checks the number is disarium or not and finds disarium numbers in a range.< + + // Added discriminant .... +
+
+

Discriminant Calculator

+

Calculates the Discriminant of a quadratic equation.

+ +
+
+

Discount Calculator

From c814be86613049d7bc3521b7fac748fe0a1ee9d7 Mon Sep 17 00:00:00 2001 From: indrajeetyadav Date: Sun, 4 Aug 2024 15:13:26 +0530 Subject: [PATCH 2/5] Added Molality Calculator --- Calculators/Molality-Calculator/index.html | 42 ++++++++++ Calculators/Molality-Calculator/script.js | 35 ++++++++ Calculators/Molality-Calculator/style.css | 98 ++++++++++++++++++++++ index.html | 15 ++++ 4 files changed, 190 insertions(+) create mode 100644 Calculators/Molality-Calculator/index.html create mode 100644 Calculators/Molality-Calculator/script.js create mode 100644 Calculators/Molality-Calculator/style.css diff --git a/Calculators/Molality-Calculator/index.html b/Calculators/Molality-Calculator/index.html new file mode 100644 index 000000000..9f5b88359 --- /dev/null +++ b/Calculators/Molality-Calculator/index.html @@ -0,0 +1,42 @@ + + + + + + + Molality Calculator + + +
+

Molality Calculator

+
+
+ + +
+
+ + + +
+
+ + + +
+ +
+
+ + grams +
+
+ + + diff --git a/Calculators/Molality-Calculator/script.js b/Calculators/Molality-Calculator/script.js new file mode 100644 index 000000000..c112c820a --- /dev/null +++ b/Calculators/Molality-Calculator/script.js @@ -0,0 +1,35 @@ +function calculateMass() { + const formulaWeight = parseFloat( + document.getElementById("formulaWeight").value + ); + let solventWeight = parseFloat(document.getElementById("solventWeight").value); + const solventUnit = document.getElementById("solventUnit").value; + let molality = parseFloat( + document.getElementById("molality").value + ); + const molalityUnit = document.getElementById("molalityUnit").value; + + if (isNaN(formulaWeight) || isNaN(solventWeight) || isNaN(molality)) { + alert("Please enter valid numbers."); + return; + } + + // Convert solvent weight to kilograms + switch (solventUnit) { + case "g": + solventWeight = solventWeight / 1000; + break; + } + + // Convert molality to mol/kg + switch (molalityUnit) { + case "mmol/kg": + molality = molality / 1000; + break; + } + + const mass = formulaWeight * molality * solventWeight; + document.getElementById("mass").value = mass.toFixed(3); + document.getElementById("result").style.animation = + "resultFadeIn 1s ease-in-out"; +} diff --git a/Calculators/Molality-Calculator/style.css b/Calculators/Molality-Calculator/style.css new file mode 100644 index 000000000..64bf06c47 --- /dev/null +++ b/Calculators/Molality-Calculator/style.css @@ -0,0 +1,98 @@ +body { + font-family: Arial, sans-serif; + background-color: #e0fae2; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + overflow: hidden; + animation: backgroundAnimation 10s infinite alternate; +} + +@keyframes backgroundAnimation { + 0% { background-color: #b3eaf1; } + 50% { background-color: #00796b; } + 100% { background-color: #2fb4c5; } +} + +.container { + background: linear-gradient(to bottom right, #ffffff, #c8e6c9); + padding: 20px; + border-radius: 16px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); + width: 90%; + max-width: 400px; + text-align: center; + animation: fadeIn 1s ease-in-out; +} + +@keyframes fadeIn { + from { opacity: 0; } + to { opacity: 1; } +} + +h1 { + margin-bottom: 20px; + color: #00796b; + font-size: 24px; + animation: textPop 1s ease-in-out; +} + +@keyframes textPop { + 0% { transform: scale(0.5); } + 100% { transform: scale(1); } +} + +.form-group { + margin-bottom: 15px; + text-align: left; +} + +label { + display: block; + margin-bottom: 5px; + color: #00796b; +} + +input[type="number"], input[type="text"], select { + width: 100%; + padding: 8px; + margin-bottom: 10px; + border: 1px solid #b0bec5; + border-radius: 4px; + box-sizing: border-box; + transition: border 0.3s; +} + +input[type="number"]:focus, input[type="text"]:focus, select:focus { + border-color: #00796b; + outline: none; +} + +button { + background: #007bff; + color: #fff; + padding: 10px; + border: none; + border-radius: 8px; + cursor: pointer; + transition: background 0.3s, transform 0.3s; +} + +button:hover { + background: #0056b3; + transform: scale(1.05); +} + +#result { + margin-top: 20px; + font-size: 18px; + color: #00796b; + animation: resultFadeIn 1s ease-in-out; +} + +@keyframes resultFadeIn { + from { opacity: 0; } + to { opacity: 1; } +} diff --git a/index.html b/index.html index 3e0d5da67..dd20eb2e9 100644 --- a/index.html +++ b/index.html @@ -3028,6 +3028,21 @@

Calculates the mass of a compound needed to achieve a desired molarity in a

+ +
+
+

Molality Calculator

+

Calculates the mass of a compound needed to achieve a desired molality in a solution.

+ +
+

Molecular Weight Calculator

From 56c44190b1579cb71024be53fcea4fd642982357 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Sat, 10 Aug 2024 16:43:03 +0530 Subject: [PATCH 3/5] Delete Calculators/discriminant directory --- Calculators/discriminant/index.html | 32 --------- Calculators/discriminant/script.js | 35 ---------- Calculators/discriminant/style.css | 101 ---------------------------- 3 files changed, 168 deletions(-) delete mode 100644 Calculators/discriminant/index.html delete mode 100644 Calculators/discriminant/script.js delete mode 100644 Calculators/discriminant/style.css diff --git a/Calculators/discriminant/index.html b/Calculators/discriminant/index.html deleted file mode 100644 index 2b9e55da9..000000000 --- a/Calculators/discriminant/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - Discriminant Calculator - - - -
-

DISCRIMINANT CALCULATOR

- -

Please enter the coefficients a, b and c of a quadratic - equation of the form:
ax² + bx + c = 0

- -
- a = - b = - c = -
-
- -

-

- - -

- - - \ No newline at end of file diff --git a/Calculators/discriminant/script.js b/Calculators/discriminant/script.js deleted file mode 100644 index 48f04fe75..000000000 --- a/Calculators/discriminant/script.js +++ /dev/null @@ -1,35 +0,0 @@ - -'use strict' - -function validate() { - // Get the input values - var a = parseFloat(document.forms["input_form"]["aterm"].value); - var b = parseFloat(document.forms["input_form"]["bterm"].value); - var c = parseFloat(document.forms["input_form"]["cterm"].value); - - var outputText, outputValue; - - // Validate the inputs - if (isNaN(a) || isNaN(b) || isNaN(c)) { - outputText = "All coefficients must be numbers!"; - } else if (a === 0) { - outputText = "a cannot be zero!"; - } else { - // Calculate the discriminant - var discriminant = Math.pow(b, 2) - 4 * a * c; - - outputText = "For the equation " + (a === 1 ? "" : a) + "x\u00B2 + " + (b === 1 ? "" : b) + "x + " + c + " = 0,"; - - if (discriminant > 0) { - outputValue = "The discriminant (D) is " + discriminant + ". There are two distinct real roots."; - } else if (discriminant === 0) { - outputValue = "The discriminant (D) is " + discriminant + ". There is exactly one real root."; - } else { - outputValue = "The discriminant (D) is " + discriminant + ". There are no real roots (complex roots)."; - } - } - - // Output the result - document.getElementById("output_text").innerHTML = outputText; - document.getElementById("outputValue").innerHTML = outputValue; -} \ No newline at end of file diff --git a/Calculators/discriminant/style.css b/Calculators/discriminant/style.css deleted file mode 100644 index 427c0ffb6..000000000 --- a/Calculators/discriminant/style.css +++ /dev/null @@ -1,101 +0,0 @@ -body { - font-family: 'Roboto', sans-serif; - margin: 0; - padding: 0; - background: linear-gradient(135deg, #3498db, #8e44ad); - background-size: cover; - color: #ecf0f1; - display: flex; - align-items: center; - justify-content: center; - height: 100vh; -} - -.container { - display: flex; - flex-direction: column; - width: 90%; - max-width: 400px; - background-color: rgba(255, 255, 255, 0.9); - padding: 20px; - border-radius: 8px; - box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); -} - -h1 { - text-align: center; - color: #2ecc71; - margin-bottom: 20px; -} - -p { - text-align: center; - color: #6b6b6b; - margin: 10px 0; -} - -#equation { - font-size: 1.2rem; - margin-bottom: 20px; -} - -form { - text-align: center; - margin-top: 20px; - margin-bottom: 20px; - color: #6b6b6b; -} - -span { - display: inline-block; - margin: 0 10px; -} - -input { - font-size: 1rem; - padding: 10px; - margin: 0 10px 10px 10px; - border: 1px solid #ccc; - border-radius: 4px; - box-sizing: border-box; - transition: border-color 0.3s ease, box-shadow 0.3s ease; - color: #2c3e50; -} - -input:hover, -input:focus { - border-color: #3498db; -} - -form div { - margin-top: 20px; -} - -button { - background-color: #e74c3c; - color: #ecf0f1; - padding: 12px 24px; - border: none; - border-radius: 4px; - cursor: pointer; - transition: background-color 0.3s ease; - margin: 0 auto; - display: block; -} - -button:hover { - background-color: #c0392b; -} - -#output_text { - margin-top: 20px; - text-align: center; - color: #404040; -} - -#outputValue { - margin-top: 10px; - font-weight: bold; - font-size: 1.2em; - color: #2ecc71; -} \ No newline at end of file From c527d54596fe29299123b2ba9faa0b0e7f475948 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Sat, 10 Aug 2024 16:43:56 +0530 Subject: [PATCH 4/5] Update index.html --- index.html | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/index.html b/index.html index dd20eb2e9..606d5f5c6 100644 --- a/index.html +++ b/index.html @@ -1540,24 +1540,7 @@

Checks the number is disarium or not and finds disarium numbers in a range.<

- - - // Added discriminant .... -
-
-

Discriminant Calculator

-

Calculates the Discriminant of a quadratic equation.

- -
-
- +

Discount Calculator

From a171ab267e1220370dea128ff7e1e501460983e0 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Sat, 10 Aug 2024 16:44:39 +0530 Subject: [PATCH 5/5] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 606d5f5c6..043da3097 100644 --- a/index.html +++ b/index.html @@ -1540,7 +1540,7 @@

Checks the number is disarium or not and finds disarium numbers in a range.<

- +

Discount Calculator