From 709641c08a7334ccc4a210324979f0b27dff4aee Mon Sep 17 00:00:00 2001 From: Aarzoo Khunger <116306749+Aarzookhunger@users.noreply.github.com> Date: Fri, 24 May 2024 23:52:46 +0530 Subject: [PATCH] Added Air Quality Index Calculator (#823) --- .../Air-Quality-Index-Calculator/README.md | 13 ++++ .../Air-Quality-Index-Calculator/index.html | 22 ++++++ .../Air-Quality-Index-Calculator/script.js | 30 ++++++++ .../Air-Quality-Index-Calculator/style.css | 73 +++++++++++++++++++ index.html | 14 ++++ 5 files changed, 152 insertions(+) create mode 100644 Calculators/Air-Quality-Index-Calculator/README.md create mode 100644 Calculators/Air-Quality-Index-Calculator/index.html create mode 100644 Calculators/Air-Quality-Index-Calculator/script.js create mode 100644 Calculators/Air-Quality-Index-Calculator/style.css diff --git a/Calculators/Air-Quality-Index-Calculator/README.md b/Calculators/Air-Quality-Index-Calculator/README.md new file mode 100644 index 000000000..93439ec05 --- /dev/null +++ b/Calculators/Air-Quality-Index-Calculator/README.md @@ -0,0 +1,13 @@ +#

Air Quality Index Calculator

+ +## Description :- + +Calculates the level of the air quality using AQI index. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Screenshots :- diff --git a/Calculators/Air-Quality-Index-Calculator/index.html b/Calculators/Air-Quality-Index-Calculator/index.html new file mode 100644 index 000000000..d776c0fe0 --- /dev/null +++ b/Calculators/Air-Quality-Index-Calculator/index.html @@ -0,0 +1,22 @@ + + + + + + Air Quality Index Calculator + + + + +
+

Air Quality Index(AQI) Calculator

+

+ + +

+ +

+
+ + + diff --git a/Calculators/Air-Quality-Index-Calculator/script.js b/Calculators/Air-Quality-Index-Calculator/script.js new file mode 100644 index 000000000..8e8534d06 --- /dev/null +++ b/Calculators/Air-Quality-Index-Calculator/script.js @@ -0,0 +1,30 @@ +function calculateAQI() { + + var aqiIndex = document.getElementById("input-id").value; + var resultElement = document.getElementById("result"); + + if (aqiIndex <= 0 || aqiIndex > 500) { + alert("Invalid input \nEnter AQI index from 1 to 500!"); + resultElement.innerHTML = ""; + resultElement.style.backgroundColor = ""; + } else if (aqiIndex >= 1 && aqiIndex <= 50) { + resultElement.innerHTML = `AQI: ${aqiIndex} - Good air quality`; + resultElement.style.backgroundColor = "green"; + } else if (aqiIndex >= 51 && aqiIndex <= 100) { + resultElement.innerHTML = `AQI: ${aqiIndex} - Moderate air quality`; + resultElement.style.backgroundColor = "yellow"; + resultElement.style.color = "black"; + } else if (aqiIndex >= 101 && aqiIndex <= 150) { + resultElement.innerHTML = `AQI: ${aqiIndex} - Unhealthy for sensitive groups`; + resultElement.style.backgroundColor = "orange"; + } else if (aqiIndex >= 151 && aqiIndex <= 200) { + resultElement.innerHTML = `AQI: ${aqiIndex} - Unhealthy`; + resultElement.style.backgroundColor = "red"; + } else if (aqiIndex >= 201 && aqiIndex <= 300) { + resultElement.innerHTML = `AQI: ${aqiIndex} - Very unhealthy`; + resultElement.style.backgroundColor = "purple"; + } else if (aqiIndex >= 301 && aqiIndex <= 500) { + resultElement.innerHTML = `AQI: ${aqiIndex} - Hazardous`; + resultElement.style.backgroundColor = "maroon"; + } +} diff --git a/Calculators/Air-Quality-Index-Calculator/style.css b/Calculators/Air-Quality-Index-Calculator/style.css new file mode 100644 index 000000000..bd8370604 --- /dev/null +++ b/Calculators/Air-Quality-Index-Calculator/style.css @@ -0,0 +1,73 @@ +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +html { + height: 100%; + margin: 0; + background-image: linear-gradient(to right, #72ff5f, #d3ef34, #f1543c); +} + +body { + display: flex; + height: 100vh; + margin: 0; + background-image: url('./assets/background.png'); + background-size: contain; + background-position: center; + background-repeat: no-repeat; + justify-content: center; + align-items: center; +} + +.container { + background-color: rgba(222, 133, 123, 0.5); + padding: 20px; + border-radius: 8px; + color: rgb(10, 10, 10); + text-align: center; + max-width: 35%; + height: 48%; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +} + +#input-label { + font-size: 18px; + font-weight: 500; + color: #000000; +} + +#input-id { + width: 100px; + border: none; + border-radius: 10px; + padding: 10px; + margin-bottom: 20px; +} + +button { + cursor: pointer; + border: none; + border-radius: 10px; + padding: 10px; + background-image: linear-gradient(to right, #72ff5f, #d3ef34, #de361c); + font-weight: bold; + box-shadow: 0 4px 6px rgba(12, 162, 27, 0.3); + transition: box-shadow 0.3s; +} + +button:hover { + box-shadow: 0 6px 8px rgba(176, 39, 29, 0.4); +} + +#result { + padding: 12px; + margin-top: 25px; + border-radius: 8px; + color: white; + text-align: center; + justify-content: center; + font-weight: bold; +} diff --git a/index.html b/index.html index 8530b8335..1d3dac916 100644 --- a/index.html +++ b/index.html @@ -160,6 +160,20 @@

Calculates the person's age by taking in the date of birth as input.

+
+
+

Air Quality Index Calculator

+

Calculates the level of the air quality using AQI index as input.

+ +
+

Antilog Calculator