diff --git a/Calculators/Astrological-Age-Calculator/README.md b/Calculators/Astrological-Age-Calculator/README.md new file mode 100644 index 000000000..044acf99a --- /dev/null +++ b/Calculators/Astrological-Age-Calculator/README.md @@ -0,0 +1,20 @@ +#

Astrological Age Calculator

+ +## Description :- + +This is a simple calculator that gives back the age of the user on different planets as selected by the user. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Features :- + +- Input validation ensures only numerical values are accepted. +- Calculates age on different planets. + +## Screenshots :- + +![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/fe890c37-805c-4de3-a2b8-fda22313d807) diff --git a/Calculators/Astrological-Age-Calculator/assets/background.jpg b/Calculators/Astrological-Age-Calculator/assets/background.jpg new file mode 100644 index 000000000..5c46bd6d2 Binary files /dev/null and b/Calculators/Astrological-Age-Calculator/assets/background.jpg differ diff --git a/Calculators/Astrological-Age-Calculator/index.html b/Calculators/Astrological-Age-Calculator/index.html new file mode 100644 index 000000000..d3c1de3b6 --- /dev/null +++ b/Calculators/Astrological-Age-Calculator/index.html @@ -0,0 +1,35 @@ + + + + + + + + Astrological Age Calculator + + + +
+
+

Astrological Age Calculator

+ + + + + +
+
+
+ + + + diff --git a/Calculators/Astrological-Age-Calculator/script.js b/Calculators/Astrological-Age-Calculator/script.js new file mode 100644 index 000000000..e1d3c2446 --- /dev/null +++ b/Calculators/Astrological-Age-Calculator/script.js @@ -0,0 +1,25 @@ +function calculateAstrologicalAge() { + const age = parseFloat(document.getElementById('age').value); + const planet = document.getElementById('planet').value; + + if (isNaN(age) || age <= 0) { + document.getElementById('result').innerText = "Please enter a valid age."; + return; + } + + const orbitalPeriods = { + Mercury: 0.24, + Venus: 0.62, + Earth: 1, + Mars: 1.88, + Jupiter: 11.86, + Saturn: 29.46, + Uranus: 84.01, + Neptune: 164.79 + }; + + const planetOrbitalPeriod = orbitalPeriods[planet]; + const ageOnPlanet = age / planetOrbitalPeriod; + + document.getElementById('result').innerText = `Your age on ${planet} is ${ageOnPlanet.toFixed(2)} years.`; +} diff --git a/Calculators/Astrological-Age-Calculator/style.css b/Calculators/Astrological-Age-Calculator/style.css new file mode 100644 index 000000000..b383faaf5 --- /dev/null +++ b/Calculators/Astrological-Age-Calculator/style.css @@ -0,0 +1,78 @@ +body { + font-family: Arial, sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + background-image: url('./assets/background.jpg'); /* Add your background image here */ + background-size: cover; + background-repeat: no-repeat; + background-position: center; + color: white; +} + +.container { + display: flex; + justify-content: center; + align-items: center; + width: 100%; +} + +.calculator { + background-color: rgba(0, 0, 0, 0.8); /* Slightly transparent for readability */ + padding: 30px; + border-radius: 10px; + box-shadow: 0 0 20px rgba(0,0,0,0.5); + width: 100%; + max-width: 400px; + text-align: center; +} + +h1 { + margin-bottom: 20px; + font-size: 24px; + color: #61dafb; +} + +label { + display: block; + margin-top: 20px; + font-weight: bold; + color: #61dafb; +} + +input, select { + width: 100%; + padding: 10px; + margin-top: 10px; + border: 1px solid #61dafb; + border-radius: 5px; + font-size: 16px; + box-sizing: border-box; + background-color: #333; + color: white; +} + +button { + width: 100%; + padding: 12px; + margin-top: 20px; + background-color: #61dafb; + color: black; + border: none; + border-radius: 5px; + font-size: 16px; + cursor: pointer; + transition: background-color 0.3s; +} + +button:hover { + background-color: #21a1f1; +} + +#result { + margin-top: 20px; + font-size: 18px; + color: #61dafb; +} diff --git a/index.html b/index.html index bcf07adc0..1ffb1713a 100644 --- a/index.html +++ b/index.html @@ -258,6 +258,21 @@

Calculates the aspect ratio of the specified height and width.

+
+
+

Astrological Age Calculator

+

Calculates the age on different planets as selected by the user.

+ +
+

Averages Calculator