From 0ba8c62d928803725a0a949f2c93f2ead0707a6e Mon Sep 17 00:00:00 2001 From: abhay-sen Date: Thu, 23 May 2024 21:23:57 +0530 Subject: [PATCH 1/8] adding the pet age calculator --- Calculators/Pet-Age-Calculator/README.md | 15 +++ Calculators/Pet-Age-Calculator/index.html | 36 +++++++ Calculators/Pet-Age-Calculator/script.js | 65 ++++++++++++ Calculators/Pet-Age-Calculator/style.css | 119 ++++++++++++++++++++++ 4 files changed, 235 insertions(+) create mode 100644 Calculators/Pet-Age-Calculator/README.md create mode 100644 Calculators/Pet-Age-Calculator/index.html create mode 100644 Calculators/Pet-Age-Calculator/script.js create mode 100644 Calculators/Pet-Age-Calculator/style.css diff --git a/Calculators/Pet-Age-Calculator/README.md b/Calculators/Pet-Age-Calculator/README.md new file mode 100644 index 000000000..be47762f2 --- /dev/null +++ b/Calculators/Pet-Age-Calculator/README.md @@ -0,0 +1,15 @@ +#

Statistics Calculator

+ +## Description :- + +Calculates Maximum, minimum, mean, median, mode, standard deviation, etc. for a list of numbers. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Screenshots :- + + diff --git a/Calculators/Pet-Age-Calculator/index.html b/Calculators/Pet-Age-Calculator/index.html new file mode 100644 index 000000000..56bfdd05f --- /dev/null +++ b/Calculators/Pet-Age-Calculator/index.html @@ -0,0 +1,36 @@ + + + + + + Pet Age Calculator + + + +
+

+ Pet Age Calculator +

+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/Calculators/Pet-Age-Calculator/script.js b/Calculators/Pet-Age-Calculator/script.js new file mode 100644 index 000000000..a4a555e7c --- /dev/null +++ b/Calculators/Pet-Age-Calculator/script.js @@ -0,0 +1,65 @@ +function CalculatePetAge(){ + var Pet = document.getElementById('PetType').value; + var Years = document.getElementById('Years').value; + var Months = document.getElementById('Months').value; + var PetAgeInHumanYears = 0; + var resultContainer = document.getElementById('result'); + if(Months>=12|| Months<0||Years<0){ + resultContainer.innerHTML = "please enter valid data"; + } + else{ + switch (Pet) { + case "Dog": + if (Years < 2) { + PetAgeInHumanYears = Years * 10.5 + Months * (10.5 / 12); + } else { + PetAgeInHumanYears = 2 * 10.5 + (Years - 2) * 4 + Months * (4 / 12); + } + break; + case "Cat": + if (Years < 2) { + PetAgeInHumanYears = Years * 12.5 + Months * (12.5 / 12); + } else { + PetAgeInHumanYears = 2 * 12.5 + (Years - 2) * 4 + Months * (4 / 12); + } + break; + case "Rabbit": + if (Years < 1) { + PetAgeInHumanYears = Years * 16 + Months * (16 / 12); + } else { + PetAgeInHumanYears = 1 * 16 + (Years - 1) * 6 + Months * (6 / 12); + } + break; + case "Parrot": + PetAgeInHumanYears = Years * 1.5 + Months * (1.5 / 12); + break; + case "Hamster": + PetAgeInHumanYears = Years * 25 + Months * (25 / 12); + break; + case "Horse": + if (Years < 3) { + PetAgeInHumanYears = Years * 6.5 + Months * (6.5 / 12); + } else { + PetAgeInHumanYears = 3 * 6.5 + (Years - 3) * 2.5 + Months * (2.5 / 12); + } + break; + default: + PetAgeInHumanYears = -1; // Default case to handle unknown pets + break; +} +function displayPetAge(PetAgeInHumanYears) { + let humanYears = Math.floor(PetAgeInHumanYears); + let humanMonths = Math.round((PetAgeInHumanYears - humanYears) * 12); + + let message = `Your pet is approximately ${humanYears} years and ${humanMonths} months old in human years.`; + document.getElementById('result').innerHTML = message; +} + +// Assuming PetAgeInHumanYears has been calculated +displayPetAge(PetAgeInHumanYears); + + + } + + } + diff --git a/Calculators/Pet-Age-Calculator/style.css b/Calculators/Pet-Age-Calculator/style.css new file mode 100644 index 000000000..91d26f125 --- /dev/null +++ b/Calculators/Pet-Age-Calculator/style.css @@ -0,0 +1,119 @@ +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + margin: 0; + padding: 0; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; + background: linear-gradient(to right, #393E46, #222831); + color: white; +} + +#container { + background-color: rgba(255, 255, 255, 0.9); + padding: 20px; + border-radius: 10px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + text-align: center; + width: 300px; + animation: fadeIn 0.8s ease-out; +} + +h1 { + margin-bottom: 20px; + color: #333; +} + +label { + display: block; + margin-bottom: 5px; + color: #555; +} + +input, +select, +button { + width: 100%; + padding: 8px; + margin-bottom: 15px; + box-sizing: border-box; + border: 1px solid #ccc; + border-radius: 5px; + outline: none; + transition: border-color 0.3s; + color: #333; + background-color: #fff; +} + +input:focus, +select:focus { + border-color: #3498db; +} + +select:hover { + transform: scale(1.02); +} + +button { + padding: 10px; + background-color: #00ADB5; + color: white; + border: none; + cursor: pointer; + border-radius: 5px; + transition: background-color 0.3s, transform 0.2s; +} + +button:hover { + background-color: #219d54; + transform: scale(1.05); +} + +#result { + margin-top: 15px; + font-weight: bold; + color: #333; + opacity: 0; + animation: fadeInResult 0.5s forwards; +} + +@keyframes fadeIn { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +@keyframes fadeInResult { + from { + opacity: 0; + transform: translateY(-10px); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes gradientAnimation { + 0% { + background-position: 0% 50%; + } + + 50% { + background-position: 100% 50%; + } + + 100% { + background-position: 0% 50%; + } +} + +body { + animation: gradientAnimation 10s linear infinite; +} \ No newline at end of file From c5558bcf84968103121c1ed897ad593b8dfe1082 Mon Sep 17 00:00:00 2001 From: abhay-sen <144714595+abhay-sen@users.noreply.github.com> Date: Thu, 23 May 2024 21:29:11 +0530 Subject: [PATCH 2/8] Update README.md --- Calculators/Pet-Age-Calculator/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Calculators/Pet-Age-Calculator/README.md b/Calculators/Pet-Age-Calculator/README.md index be47762f2..f39366b8b 100644 --- a/Calculators/Pet-Age-Calculator/README.md +++ b/Calculators/Pet-Age-Calculator/README.md @@ -11,5 +11,6 @@ Calculates Maximum, minimum, mean, median, mode, standard deviation, etc. for a - JavaScript ## Screenshots :- +![Screenshot 2024-05-23 211526](https://github.com/abhay-sen/CalcDiverse/assets/144714595/b41578a3-8f72-4571-b8c8-e76e44e08e81) From d3c1e72d95cf7054edc78feab2c0600c39b1bab2 Mon Sep 17 00:00:00 2001 From: abhay-sen <144714595+abhay-sen@users.noreply.github.com> Date: Thu, 23 May 2024 21:35:48 +0530 Subject: [PATCH 3/8] Update README.md --- Calculators/Pet-Age-Calculator/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Calculators/Pet-Age-Calculator/README.md b/Calculators/Pet-Age-Calculator/README.md index f39366b8b..58aceea3e 100644 --- a/Calculators/Pet-Age-Calculator/README.md +++ b/Calculators/Pet-Age-Calculator/README.md @@ -11,6 +11,6 @@ Calculates Maximum, minimum, mean, median, mode, standard deviation, etc. for a - JavaScript ## Screenshots :- -![Screenshot 2024-05-23 211526](https://github.com/abhay-sen/CalcDiverse/assets/144714595/b41578a3-8f72-4571-b8c8-e76e44e08e81) +![image](https://github.com/Rakesh9100/CalcDiverse/assets/144714595/1f1ff4ef-598f-4155-b10b-371e187e0cdc) From 09e89e8b1fd5c146bc5d28821240dab83c4d5eb9 Mon Sep 17 00:00:00 2001 From: abhay-sen <144714595+abhay-sen@users.noreply.github.com> Date: Thu, 23 May 2024 21:39:53 +0530 Subject: [PATCH 4/8] Update index.html --- index.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index aab0626e6..8a384659d 100644 --- a/index.html +++ b/index.html @@ -1350,6 +1350,20 @@

Calculates nPr and nCr after taking inputs as n and r.

+
+
+

Pet Age Calculator

+

Calculates the age of Pets in human years.

+ +
+

Power Calculator

@@ -1993,4 +2007,4 @@

Calculates the linear density of the yarn from unit system to another.

- \ No newline at end of file + From 4a0efbbcb45177e67fc865cf3aff5e5cc540b952 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 24 May 2024 15:25:25 +0530 Subject: [PATCH 5/8] Update README.md --- Calculators/Pet-Age-Calculator/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Calculators/Pet-Age-Calculator/README.md b/Calculators/Pet-Age-Calculator/README.md index 58aceea3e..e18c8b52f 100644 --- a/Calculators/Pet-Age-Calculator/README.md +++ b/Calculators/Pet-Age-Calculator/README.md @@ -1,8 +1,8 @@ -#

Statistics Calculator

+#

Pet Age Calculator

## Description :- -Calculates Maximum, minimum, mean, median, mode, standard deviation, etc. for a list of numbers. +Calculates a pet's age in human years. ## Tech Stacks :- @@ -11,6 +11,5 @@ Calculates Maximum, minimum, mean, median, mode, standard deviation, etc. for a - JavaScript ## Screenshots :- -![image](https://github.com/Rakesh9100/CalcDiverse/assets/144714595/1f1ff4ef-598f-4155-b10b-371e187e0cdc) - +![image](https://github.com/Rakesh9100/CalcDiverse/assets/144714595/1f1ff4ef-598f-4155-b10b-371e187e0cdc) From 84e94b389281093dea56742908c82e2180560a38 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 24 May 2024 15:26:46 +0530 Subject: [PATCH 6/8] Update style.css --- Calculators/Pet-Age-Calculator/style.css | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Calculators/Pet-Age-Calculator/style.css b/Calculators/Pet-Age-Calculator/style.css index 91d26f125..9a20708d3 100644 --- a/Calculators/Pet-Age-Calculator/style.css +++ b/Calculators/Pet-Age-Calculator/style.css @@ -8,6 +8,7 @@ body { height: 100vh; background: linear-gradient(to right, #393E46, #222831); color: white; + animation: gradientAnimation 10s linear infinite; } #container { @@ -113,7 +114,3 @@ button:hover { background-position: 0% 50%; } } - -body { - animation: gradientAnimation 10s linear infinite; -} \ No newline at end of file From 297f93a0f5231f8fd74e2dcf85dced6167d3caf5 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 24 May 2024 15:28:19 +0530 Subject: [PATCH 7/8] Update index.html --- index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 727649e7a..5fefa2567 100644 --- a/index.html +++ b/index.html @@ -1380,15 +1380,14 @@

Calculates nPr and nCr after taking inputs as n and r.

-

Pet Age Calculator

-

Calculates the age of Pets in human years.

+

Calculates a pet's age in human years.

From 6f55558f87d2207558a165da741e023fc6e61c60 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 24 May 2024 15:29:11 +0530 Subject: [PATCH 8/8] Update index.html --- index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/index.html b/index.html index 5fefa2567..00f40da08 100644 --- a/index.html +++ b/index.html @@ -1401,7 +1401,6 @@

Calculates the density of the population in a specific area.

- Source Code