-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #527 from apu52/Temperature-Converter
Temperature converter[GSSOC'23]
- Loading branch information
Showing
8 changed files
with
392 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) + ` °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) + ` °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) + ` °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) + ` °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" | ||
} | ||
} |
Oops, something went wrong.