From 804a411bed7325a5af0eefcda39951aa171f08b2 Mon Sep 17 00:00:00 2001
From: Prayag Thakur <114804510+PrAyAg9@users.noreply.github.com>
Date: Tue, 22 Oct 2024 19:42:14 +0530
Subject: [PATCH] Added Eco-friendly Decision Maker
---
.../Eco-friendly Decision Maker/index.html | 31 +++++++++++++
.../Eco-friendly Decision Maker/script.js | 23 ++++++++++
.../Eco-friendly Decision Maker/styles.css | 44 +++++++++++++++++++
3 files changed, 98 insertions(+)
create mode 100644 projects/Eco-friendly Decision Maker/index.html
create mode 100644 projects/Eco-friendly Decision Maker/script.js
create mode 100644 projects/Eco-friendly Decision Maker/styles.css
diff --git a/projects/Eco-friendly Decision Maker/index.html b/projects/Eco-friendly Decision Maker/index.html
new file mode 100644
index 00000000..0b3af2b2
--- /dev/null
+++ b/projects/Eco-friendly Decision Maker/index.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Eco-Friendly Decision Maker
+
+
+
+
Eco-Friendly Decision Maker
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Eco-friendly Decision Maker/script.js b/projects/Eco-friendly Decision Maker/script.js
new file mode 100644
index 00000000..dd79948a
--- /dev/null
+++ b/projects/Eco-friendly Decision Maker/script.js
@@ -0,0 +1,23 @@
+const carbonFootprintData = {
+ car: { footprint: 250, suggestion: "Consider carpooling or using public transport." },
+ bus: { footprint: 100, suggestion: "Great choice! You can further reduce impact by walking to the station." },
+ bike: { footprint: 10, suggestion: "Awesome! Riding a bike is eco-friendly." },
+ walk: { footprint: 0, suggestion: "Excellent! Walking is the most eco-friendly option." },
+ shop: { footprint: 20, suggestion: "Consider buying local products or using eco-friendly materials." }
+};
+
+document.getElementById('calculate-button').addEventListener('click', () => {
+ const choice = document.getElementById('choice').value;
+ const result = carbonFootprintData[choice];
+
+ document.getElementById('result').textContent = `Your estimated carbon footprint: ${result.footprint} g CO2`;
+ document.getElementById('suggestion').textContent = result.suggestion;
+
+ document.getElementById('form-container').style.display = 'none';
+ document.getElementById('result-container').style.display = 'block';
+});
+
+document.getElementById('restart-button').addEventListener('click', () => {
+ document.getElementById('form-container').style.display = 'block';
+ document.getElementById('result-container').style.display = 'none';
+});
diff --git a/projects/Eco-friendly Decision Maker/styles.css b/projects/Eco-friendly Decision Maker/styles.css
new file mode 100644
index 00000000..fe00dd0c
--- /dev/null
+++ b/projects/Eco-friendly Decision Maker/styles.css
@@ -0,0 +1,44 @@
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ background-color: #f0f8ff;
+ color: #333;
+ font-family: Arial, sans-serif;
+ height: 100vh;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.container {
+ text-align: center;
+ background-color: white;
+ padding: 20px;
+ border-radius: 10px;
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
+}
+
+label {
+ margin-right: 10px;
+}
+
+select, button {
+ padding: 10px;
+ margin-top: 10px;
+ border-radius: 5px;
+ border: 1px solid #ccc;
+}
+
+button {
+ background-color: #28a745;
+ color: white;
+ cursor: pointer;
+}
+
+button:hover {
+ background-color: #218838;
+}