Skip to content

Commit

Permalink
Merge pull request #527 from apu52/Temperature-Converter
Browse files Browse the repository at this point in the history
Temperature converter[GSSOC'23]
  • Loading branch information
cleveranu authored Aug 3, 2023
2 parents 4f6df66 + 275cbe2 commit e4bdd4e
Show file tree
Hide file tree
Showing 8 changed files with 392 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,13 @@ <h3 class="card__heading">Stopwatch</h3>
<h3 class="card__heading">Hotstar_Clone</h3>
</div>
</a>
<a class="card" href="projects/Temperature Converter/index.html">
<div class="card__background" style="background-image: url(projects/Temperature Converter/Temperature Converter.png)"></div>
<div class="card__content">
<p class="card__category">Convert Temarature Application</p>
<h3 class="card__heading">Temperature Converter</h3>
</div>
</a>
</div>
</section>

Expand Down
15 changes: 15 additions & 0 deletions projects/Temperature Converter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<h1 align="center">Temperature Converter </h1>

<div>
<br>
<h2>Hello Sir/Ma'am👋, Here is my Project of Temperature Converter </h2>
<h3>Issue No. #497</h3>


<p>Hello Coders👨‍💻 ,I am Arpan Chowdhury, a aspiring Web developer.🤖 Here is the project of the front-end Web Developement.This repo contains my project on temperature converter🥵 using HTML,CSS & JS. It contains conversion of different temperature parameters which are Celsius, Fahrenheit , Kelvin , Rankine.
I want to add my Project under GSSOC 2.0 . Please take a review of my PR & please merge it. 🙏</p>

# Video

https://github.com/apu52/Code-Canvas/assets/114172928/15ac337e-d4e2-4b9d-8d0d-5f4a7034ebb3

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
64 changes: 64 additions & 0 deletions projects/Temperature Converter/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Temperature Converter</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
</head>

<body>
<div class="background-image"></div>
<div class="container">
<div class="task-bar">
<div id="p1"></div>
<div class="icons">
<i class="bi bi-bell-slash-fill"></i>
<i class="bi bi-bluetooth"></i>
<i class="bi bi-battery-charging"></i>
</div>
</div>
<h1>Celcius-Fahrenheit-Kelvin-Rankine Converter</h1>
<div class="inputs">
<div style="display: flex;
flex-direction: column;">
<label for="degree">Value <span id="small">(In Numbers...)</span></label>
<input type="number" name="degree" id="inputValue" required>
</div>
<div class="inptsss">
<div>
<label for="type">From</label>
<select name="type" id="type1">
<option value="celcius">Celcius</option>
<option value="fahrenheit">Fahrenheit</option>
<option value="kelvin">Kelvin</option>
<option value="rankine">Rankine</option>
</select>
</div>
<div>
<label for="type">To</label>
<select name="type" id="type2">
<option value="celcius">Celcius</option>
<option value="fahrenheit">Fahrenheit</option>
<option value="kelvin">Kelvin</option>
<option value="rankine">Rankine</option>
</select>
</div>
</div>
</div>
<button type="submit" id="btn" onclick="temperature()">Convert</button>
<div class="resultss">
<label for="result">Result</label>
<div id="result"></div>
</div>
</div>

<div class="footer">
<p>Designed by <a href="https://www.linkedin.com/in/arpan-chowdhury-775294251/">Arpan Chowdhury</a></p>
</div>
<script src="main.js"></script>
</body>
</html>
90 changes: 90 additions & 0 deletions projects/Temperature Converter/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Logic for the digital watch
function currentTime() {
let p1 = document.getElementById("p1")
let date = new Date();
let hr = date.getHours();
let mn = date.getMinutes();
let ss = date.getSeconds();
let current_time = hr + ":" + mn + ":" + ss;
p1.innerHTML = current_time;
let t = setTimeout(function () { currentTime() }, 1000);
}
currentTime();



// Logic for temperature converter
function temperature() {
let inputValue = document.querySelector("#inputValue").value;
let type1 = document.querySelector("#type1");
let type2 = document.querySelector("#type2");
let result = document.querySelector("#result");
if (inputValue == "") {
alert("Please Enter any Number....")
location.reload()
}
else if (type1.value == "celcius" && type2.value == "celcius") {
let Celcius = Number.parseInt(inputValue) * 1
result.innerHTML = Celcius.toFixed(3) + ` &deg;C`
}
else if (type1.value == "celcius" && type2.value == "fahrenheit") {
let Fahrenheit = Number.parseInt(inputValue) * (9 / 5) + 32
result.innerHTML = Fahrenheit.toFixed(3) + " F"
}
else if (type1.value == "celcius" && type2.value == "kelvin") {
let Kelvin = Number.parseInt(inputValue) + 273.15
result.innerHTML = Kelvin.toFixed(3) + " K"
}
else if (type1.value == "celcius" && type2.value == "rankine") {
let Rankine = Number.parseInt(inputValue) * (9 / 5) + 491.67
result.innerHTML = Rankine.toFixed(3) + " R"
}
else if (type1.value == "fahrenheit" && type2.value == "celcius") {
let Celcius = Number.parseInt(inputValue) - 32 * (5 / 9)
result.innerHTML = Celcius.toFixed(3) + ` &deg;C`
}
else if (type1.value == "fahrenheit" && type2.value == "fahrenheit") {
let Fahrenheit = Number.parseInt(inputValue) * 1
result.innerHTML = Fahrenheit.toFixed(3) + " F"
}
else if (type1.value == "fahrenheit" && type2.value == "kelvin") {
let Kelvin = Number.parseInt(inputValue) - 32 * (5 / 9) + 273.15
result.innerHTML = Kelvin.toFixed(3) + " K"
}
else if (type1.value == "fahrenheit" && type2.value == "rankine") {
let Rankine = Number.parseInt(inputValue) + 459.67
result.innerHTML = Rankine.toFixed(3) + " R"
}
else if (type1.value == "kelvin" && type2.value == "celcius") {
let Celcius = Number.parseInt(inputValue) - 273.15
result.innerHTML = Celcius.toFixed(3) + ` &deg;C`
}
else if (type1.value == "kelvin" && type2.value == "fahrenheit") {
let Fahrenheit = Number.parseInt(inputValue) - 273.15 * (9 / 5) + 32
result.innerHTML = Fahrenheit.toFixed(3) + " F"
}
else if (type1.value == "kelvin" && type2.value == "kelvin") {
let Kelvin = Number.parseInt(inputValue) * 1
result.innerHTML = Kelvin.toFixed(3) + " K"
}
else if (type1.value == "kelvin" && type2.value == "rankine") {
let Rankine = Number.parseInt(inputValue) * 1.8
result.innerHTML = Rankine.toFixed(3) + " R"
}
else if (type1.value == "rankine" && type2.value == "celcius") {
let Celcius = Number.parseInt(inputValue) - 491.67 * (5 / 9)
result.innerHTML = Celcius.toFixed(3) + ` &deg;C`
}
else if (type1.value == "rankine" && type2.value == "fahrenheit") {
let Fahrenheit = Number.parseInt(inputValue) - 495.67
result.innerHTML = Fahrenheit.toFixed(3) + " F"
}
else if (type1.value == "rankine" && type2.value == "kelvin") {
let Kelvin = Number.parseInt(inputValue) * (5 / 9)
result.innerHTML = Kelvin.toFixed(3) + " K"
}
else if (type1.value == "rankine" && type2.value == "rankine") {
let Rankine = Number.parseInt(inputValue) * 1
result.innerHTML = Rankine.toFixed(3) + " R"
}
}
Loading

0 comments on commit e4bdd4e

Please sign in to comment.