Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions html/JS-Dom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Part 1 - Converting Fahrenheit value to Celsius with click button
//Part 2 - Converting Fahrenheit value to Kelvin and Rankine


const calculate = () => {
const fv = parseFloat(document.getElementById('fahv').value);

let newfahv = (fv);
console.log(newfahv); //verified the calculation
document.getElementById("fahv2").value = newfahv;


let newcelv = (fv - 32) * 5/9;
console.log(newcelv); //verified the calculation
document.getElementById("celv").value = newcelv;


let newkelv = parseFloat((fv - 32) / 1.8) + 273.15;
console.log(newkelv); //verified the calculation
document.getElementById("kelv").value = newkelv;


let newrankv = parseFloat(fv + 459.67).toFixed(2);
console.log(newrankv); //verified the calculation
document.getElementById("rankv").value = newrankv;

}
File renamed without changes
File renamed without changes
File renamed without changes
48 changes: 48 additions & 0 deletions html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Temperature Scale Convertor</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class ="container">
<h1 class="h1">Temperature Scale Convertor</h1>

<div class="row">
<div class="value">Value</div>
</div>

<div class="row">
<div class="col-md-3">
<div class="fahrenheit">Fahrenheit</div>
<input id="fahv" type="number" name="fahrenheit"/>

<button id="myBtn" onclick="calculate()">Calculate</button>
</div>
</div>

<div class="row">
<div class="col-md-4">
<div class="fahrenheit2"><strong>Fahrenheit</strong></div>
<div class="celsius"><strong>Celsius</strong></div>
<div class="kelvin"><strong>Kelvin</strong></div>
<div class="rankine"><strong>Rankine</strong></div>
</div>
</div>

<div class="row">
<div class="col-md-4">
<input id="fahv2" type="number" name="fahrenheit" />
<input id="celv" type="number" name="celsius" />
<input id="kelv" type="number" name="kelvin" />
<input id="rankv" type="number" name="rankine" />
</div>
</div>

</div>

<script src="JS-Dom.js"></script>
</body>
</html>
133 changes: 133 additions & 0 deletions html/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
* {
padding: 0px;
margin: 0px;
}

body {
width: 788px;
height: 490px;
font-family: Arial, Helvetica, sans-serif;
}

.container {
width: 720px;
height: 419px;
border: 2px solid black;
padding: 40px;
margin: 3px 34px 34px 34px;
}

.h1 {
font-size: 51px;
justify-content: center;
margin-bottom: 30px;
}

.value {
justify-content: center;
font-size: 25px;
padding-top: 30px;
margin-left: 327px;
}

.fahrenheit {
margin-left: 10px;
font-size: 25px;
}

.fahrenheit2 {
font-size: 25px;
text-align: center;
padding-top: 30px;
padding-bottom: 5px;
}

.celsius {
text-align: center;
font-size: 25px;
padding-top: 30px;
padding-bottom: 5px;
}

.kelvin {
text-align: center;
font-size: 25px;
padding-top: 30px;
padding-bottom: 5px;
}

.rankine {
text-align: center;
font-size: 25px;
padding-top: 30px;
padding-bottom: 5px;
}

.col-md-3 {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
padding-top: 15px;
}

.col-md-4 {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr;
padding-top: 15px;
}

#myBtn {
width: 162px;
height: 42px;
background-color: rgb(221, 232, 250);
border: 2px solid rgb(114, 142, 187);
font-size: 25px;
margin-left: 70px;
}

#fahv {
width: 162px;
height: 42px;
margin-left: 40px;
font-size: 25px;
text-align: center;
border: 2px solid #000000;
}

#fahv2 {
width: 162px;
height: 42px;
margin-left: 10px;
font-size: 25px;
text-align: center;
border: none;
}

#celv {
width: 162px;
height: 42px;
margin-left: 10px;
font-size: 25px;
text-align: center;
border: none;
}

#kelv {
width: 162px;
height: 42px;
margin-left: 10px;
font-size: 25px;
text-align: center;
border: none;
}

#rankv {
width: 162px;
height: 42px;
margin-left: 10px;
font-size: 25px;
text-align: center;
border: none;
}