diff --git a/Calculators/Plant-Growth-Calculator/README.md b/Calculators/Plant-Growth-Calculator/README.md new file mode 100644 index 000000000..a8b9ad6e1 --- /dev/null +++ b/Calculators/Plant-Growth-Calculator/README.md @@ -0,0 +1,34 @@ +#

Plant Growth Calculator

+ +## Description :- + +This is a web application designed to forecast the growth rate of your houseplants. This tool considers various factors such as plant species, light, water, soil conditions, and temperature to provide accurate predictions. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Features :- + +- Select the species of your plant (Succulents, Ferns, Flowering Plants, Vegetables). +- Select the type of light condition (Full Sunlight, Partial Shade, Indirect Light). +- Enter the watering amount as a percentage of plant needs. +- Select the type of soil (Sandy, Loamy, Clay). +- Enter the ambient temperature in degrees Celsius. +- Perform the calculation and display the predicted growth rate in inches per month. + +## Example :- + +To predict the growth rate of a Tomato plant: +1. Select "Vegetables" from the plant species dropdown menu. +2. Select "Full Sunlight" from the light conditions dropdown menu (Tomato plants thrive in full sunlight). +3. Enter the watering amount, for example, 80% (Tomato plants require consistent watering). +4. Select "Loamy" from the soil type dropdown menu (Tomato plants prefer well-draining loamy soil). +5. Enter the ambient temperature, for example, 25°C (Tomato plants grow well in warm temperatures). +6. Click "Calculate Prediction" to get the predicted growth rate in inches per month. + +## Screenshots :- + +![image](https://github.com/Rakesh9100/CalcDiverse/assets/118645569/5208670c-c86e-4df5-a90a-2fdef84dd7f4) diff --git a/Calculators/Plant-Growth-Calculator/assets/background.jpg b/Calculators/Plant-Growth-Calculator/assets/background.jpg new file mode 100644 index 000000000..e9fc69767 Binary files /dev/null and b/Calculators/Plant-Growth-Calculator/assets/background.jpg differ diff --git a/Calculators/Plant-Growth-Calculator/index.html b/Calculators/Plant-Growth-Calculator/index.html new file mode 100644 index 000000000..3bd98e3e4 --- /dev/null +++ b/Calculators/Plant-Growth-Calculator/index.html @@ -0,0 +1,56 @@ + + + + + + + + Plant Growth Calculator + + + +
+

Plant Growth Predictor

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + + + + diff --git a/Calculators/Plant-Growth-Calculator/script.js b/Calculators/Plant-Growth-Calculator/script.js new file mode 100644 index 000000000..618206f03 --- /dev/null +++ b/Calculators/Plant-Growth-Calculator/script.js @@ -0,0 +1,59 @@ +// Define factors' weights for calculation +const LIGHT_WEIGHTS = { + 'full_sunlight': 1.2, + 'partial_shade': 1, + 'indirect_light': 0.8 +}; + +const WATERING_WEIGHT = 0.5; + +const SOIL_WEIGHTS = { + 'sandy': 0.8, + 'loamy': 1, + 'clay': 0.9 +}; + +// Define base growth rates for different plant species +const BASE_GROWTH_RATES = { + 'succulents': 0.5, + 'ferns': 0.8, + 'flowering': 1, + 'vegetables': 1.2 +}; + +// Define minimum and maximum growth rates +const MIN_GROWTH_RATE = 0.1; +const MAX_GROWTH_RATE = 2; + +function calculatePrediction() { + // Get input values + const plantSpecies = document.getElementById('plantType').value; + const lightCondition = document.getElementById('lightType').value; + const wateringAmount = parseFloat(document.getElementById('wateringInput').value); + const soilCondition = document.getElementById('soilType').value; + const temperature = parseFloat(document.getElementById('temperatureInput').value); + + // Get base growth rate for selected plant species + const baseGrowthRate = BASE_GROWTH_RATES[plantSpecies]; + + // Calculate prediction based on inputs + const lightFactor = LIGHT_WEIGHTS[lightCondition]; + const wateringFactor = Math.min(wateringAmount / 100, 1) * WATERING_WEIGHT; + const soilFactor = SOIL_WEIGHTS[soilCondition]; + + // Adjust growth rate based on temperature + let temperatureFactor = 1; + if (temperature < 10) { + temperatureFactor = 0.8; + } else if (temperature > 30) { + temperatureFactor = 0.9; + } + + // Calculate growth rate + const growthRate = baseGrowthRate * ((lightFactor + wateringFactor + soilFactor + temperatureFactor) / 4 * (MAX_GROWTH_RATE - MIN_GROWTH_RATE) + MIN_GROWTH_RATE); + + // Display prediction + const predictionResult = document.getElementById('predictionResult'); + predictionResult.textContent = `Predicted growth rate for ${plantSpecies}: ${growthRate.toFixed(2)} inches per month`; + predictionResult.style.display = 'block'; +} diff --git a/Calculators/Plant-Growth-Calculator/style.css b/Calculators/Plant-Growth-Calculator/style.css new file mode 100644 index 000000000..1b6d13e46 --- /dev/null +++ b/Calculators/Plant-Growth-Calculator/style.css @@ -0,0 +1,76 @@ +body, +html { + height: 100%; + margin: 0; + font-family: Arial, sans-serif; + background-image: url('assets/background.jpg'); + background-size: cover; + background-repeat: no-repeat; +} + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; +} + +h1 { + text-align: center; + margin-bottom: 20px; +} + +form { + background-color: rgba(255, 255, 255, 0.8); + padding: 20px; + border-radius: 10px; + box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); + width: 90%; + max-width: 400px; +} + +label { + display: block; + margin-top: 10px; +} + +input, +select { + width: 100%; + padding: 10px; + margin-top: 5px; + border-radius: 5px; + border: 1px solid #ccc; + box-sizing: border-box; +} + +button { + display: block; + margin-top: 10px; + padding: 10px; + background-color: #4CAF50; + color: white; + border: none; + cursor: pointer; + width: 100%; + border-radius: 5px; +} + +button:hover { + background-color: #45a049; +} + +div { + margin-bottom: 1rem; +} + +div label { + font-size: large; +} + +#predictionResult { + margin-top: 20px; + font-size: 20px; + text-align: center; +} diff --git a/index.html b/index.html index e74800ddd..5e1cb9638 100644 --- a/index.html +++ b/index.html @@ -2360,6 +2360,20 @@

Calculates various parameters of planetary motion using Kepler's laws.

+
+
+

Plant Growth Calculator

+

Calculates the average growth rate for your plants based on various parameters.

+ +
+

Plant Watering Calculator