From a321aaaa47280400e3f34afb09f8bedda8555a8c Mon Sep 17 00:00:00 2001 From: Manny-Ellegood10 Date: Fri, 8 Jan 2021 17:16:44 -0500 Subject: [PATCH 1/2] completed part 2 --- 2021.css | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2021.html | 35 ++++++++++++++++++ app.js | 32 ++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 2021.css create mode 100644 2021.html create mode 100644 app.js diff --git a/2021.css b/2021.css new file mode 100644 index 0000000..3db0bb5 --- /dev/null +++ b/2021.css @@ -0,0 +1,107 @@ +* { + font-family: sans-serif; + +} + +.grid-container { + display: grid; + grid-template-rows: repeat(3, 1fr); + +} + +.grid-item { + background-color: white; + padding: 1px; + font-size: 30px; + text-align: center; + +} + +.grid-item3 { + background-color: white; + padding: 2px; + font-size: 30px; + text-align: center; + padding-bottom: 150px; + + +} + +#horizontal-list { + width: 1200px; + margin-left: 300px; + margin-top: 80px; + + +} + + +#horizontal-list { + font-size: 30px; + font-weight: bold; + padding-top: 20px; + display: inline; +} + +.list1 { + position: relative; + padding-left: 550px; + float: left; +} + +.list2 { + position: relative; + padding-left: 110px; + float: left; + +} + +.list3 { + position: relative; + padding-left: 100px; + float: left; + +} +.list4 { + position: relative; + padding-left: 120px; + float: left; + +} + +input[type=number] { + width: 200px; + height: 60px; + text-align: center; + box-sizing: border-box; + border: 2px solid black; + border-radius: 1px; + font-size: 25px; + position: relative; + right: 140px; +} + +button { + border-radius: 1px; + background-color: rgb(228, 248, 255); + font-size: 25px; + cursor: pointer; + width: 150px; + height: 60px; + position: relative; + left: 10px; + + } +.fah { + border-radius: 1px; + font-size: 25px; + cursor: pointer; + width: 150px; + height: 60px; + position: relative; + margin-right : 300px; +} + + + + \ No newline at end of file diff --git a/2021.html b/2021.html new file mode 100644 index 0000000..74e097e --- /dev/null +++ b/2021.html @@ -0,0 +1,35 @@ + + + + + + + Temp Converter Lab + + +
+
+

Temperature Scale Convertor

+
+
+

Value

+ + + +
+
+
+
Fahrenheit +

+
Celsius +

+
Kelvin +

+
Rankine +

+
+
+
+ + + \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..18683d6 --- /dev/null +++ b/app.js @@ -0,0 +1,32 @@ + +function convertToc() { + let fahrenheit = document.getElementById("inputKG").value; + let celsiusTemp = (fahrenheit - 32) * (5/9); + return document.getElementById("celsConverted").innerHTML = `${celsiusTemp} C`; +} + +function convertTof() { + let fahrenheit = document.getElementById("inputKG").value; + return document.getElementById("fahConverted").innerHTML = `${fahrenheit} F`; +} + +// K=((℉-32)/1.8)+273.15 +function convertTok() { + let fahrenheit = document.getElementById("inputKG").value; + let kelvin = ((fahrenheit - 32)/1.8) + 273.15; + return document.getElementById("kelConverted").innerHTML = `${kelvin} K`; + +} + +function convertTor() { + let fahrenheit = document.getElementById("inputKG").value; + let rankine = (fahrenheit * 1) + 459.67; + return document.getElementById("ranConverted").innerHTML = `${rankine.toFixed(2)} R`; +} + +function convertAll () { + + (convertTof() & convertToc() & convertTok() + & convertTor()); + +} From cccf6e3679d25adaa967fa6065d690c4f2ae2c31 Mon Sep 17 00:00:00 2001 From: Manny-Ellegood10 Date: Mon, 11 Jan 2021 20:29:56 -0500 Subject: [PATCH 2/2] completed part 3 --- 2021.css | 45 +++++++++++++++++------- 2021.html | 10 +++++- app.js | 102 +++++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 135 insertions(+), 22 deletions(-) diff --git a/2021.css b/2021.css index 3db0bb5..7eca762 100644 --- a/2021.css +++ b/2021.css @@ -70,15 +70,15 @@ } input[type=number] { - width: 200px; + width: 190px; height: 60px; text-align: center; box-sizing: border-box; border: 2px solid black; border-radius: 1px; - font-size: 25px; + font-size: 30px; position: relative; - right: 140px; + right: 285px; } button { @@ -89,19 +89,38 @@ button { width: 150px; height: 60px; position: relative; - left: 10px; + right: 125px; } -.fah { - border-radius: 1px; - font-size: 25px; - cursor: pointer; - width: 150px; - height: 60px; - position: relative; - margin-right : 300px; + + +.scale { + float: left; + padding-left: 550px; + font-weight: bold; + +} + +.value { + padding-right: 700px; + font-weight: bold; } + +.temp { + border: 10px; + + +} + +select { + font-weight: bold; + float: left; + width: 170px; + height: 60px; + margin-left: 520px; + font-size: 27px; + text-align: center; - \ No newline at end of file +} \ No newline at end of file diff --git a/2021.html b/2021.html index 74e097e..bbb1c4a 100644 --- a/2021.html +++ b/2021.html @@ -12,8 +12,16 @@

Temperature Scale Convertor

+

Scale

Value

- + +
diff --git a/app.js b/app.js index 18683d6..f827e54 100644 --- a/app.js +++ b/app.js @@ -1,32 +1,118 @@ function convertToc() { - let fahrenheit = document.getElementById("inputKG").value; + let fahrenheit = parseFloat(document.getElementById("inputKG").value); let celsiusTemp = (fahrenheit - 32) * (5/9); - return document.getElementById("celsConverted").innerHTML = `${celsiusTemp} C`; + return document.getElementById("celsConverted").innerHTML = `${celsiusTemp.toFixed(2)} C`; +} + +// Celsius Formulas +function celsToF() { + let celsiusTemp = document.getElementById("inputKG").value; + let fahrenheit = (celsiusTemp * 9/5) + 32; + return document.getElementById("fahConverted").innerHTML = `${fahrenheit.toFixed(2)} F`; + +} +function celsToK() { + let celsiusTemp = parseFloat(document.getElementById("inputKG").value); + let kelvinTemp = (celsiusTemp * 1) + 273.15; + return document.getElementById("kelConverted").innerHTML = `${kelvinTemp} K`; +} + +function celsToR() { + let celsiusTemp = parseFloat(document.getElementById("inputKG").value); + let rankineTemp = (celsiusTemp + 273.15) * (9/5); + return document.getElementById("ranConverted").innerHTML = `${rankineTemp.toFixed(2)} R`; +} + +function ConvertCelsToAll () { + celsToR() & celsToF() & celsToK(); +} + +// Rankine Formulas +function rankToF() { + let rankTemp = parseFloat(document.getElementById("inputKG").value); + let fahrenheit = (rankTemp * 1) - 459.67; + document.getElementById("fahConverted").innerHTML = `${fahrenheit.toFixed(2)} F`; +} + +function rankToC() { + let rankTemp = parseFloat(document.getElementById("inputKG").value); + let celsiusTemp = (rankTemp - 491.67) * 5/9; + document.getElementById("celsConverted").innerHTML = `${celsiusTemp.toFixed(2)} C`; +} + +function rankToK() { + let rankTemp = parseFloat(document.getElementById("inputKG").value); + let kelvinTemp = rankTemp * 5/9; + document.getElementById("kelConverted").innerHTML = `${kelvinTemp.toFixed(2)} K`; +} + +function ConvertRankToAll () { + rankToK() & rankToC() & rankToF(); +} + +// Kelvin Formulas +function kelToF() { + let kelvinTemp = parseFloat(document.getElementById("inputKG").value); + let fahrenheit = (kelvinTemp * 9/5) - 459.67; + (document.getElementById("fahConverted").innerHTML = `${fahrenheit.toFixed(2)} F`); + +} + +function kelToC() { + let kelvinTemp = parseFloat(document.getElementById("inputKG").value); + let celsiusTemp = (kelvinTemp * 1) - 273.15; + return document.getElementById("celsConverted").innerHTML = `${celsiusTemp.toFixed(2)} C`; + +} + +function kelToR() { + let kelvinTemp = parseFloat(document.getElementById("inputKG").value); + let rankineTemp = kelvinTemp * 9/5; + return document.getElementById("ranConverted").innerHTML = `${rankineTemp.toFixed(2)} R`; + +} + +function ConvertKelToAll() { + kelToR() & kelToC() & kelToF(); } function convertTof() { - let fahrenheit = document.getElementById("inputKG").value; + let fahrenheit = parseFloat(document.getElementById("inputKG").value); return document.getElementById("fahConverted").innerHTML = `${fahrenheit} F`; } // K=((℉-32)/1.8)+273.15 function convertTok() { - let fahrenheit = document.getElementById("inputKG").value; + let fahrenheit = parseFloat(document.getElementById("inputKG").value); let kelvin = ((fahrenheit - 32)/1.8) + 273.15; - return document.getElementById("kelConverted").innerHTML = `${kelvin} K`; + return document.getElementById("kelConverted").innerHTML = `${kelvin.toFixed(2)} K`; } function convertTor() { - let fahrenheit = document.getElementById("inputKG").value; + let fahrenheit = parseFloat(document.getElementById("inputKG").value); let rankine = (fahrenheit * 1) + 459.67; return document.getElementById("ranConverted").innerHTML = `${rankine.toFixed(2)} R`; } -function convertAll () { +function convertAll() { + var userChosenConversion = document.getElementById("temp").value; + console.log({userChosenConversion}) + switch(userChosenConversion) { + case "Fahrenheit": + (convertTof() & convertToc() & convertTok() & convertTor()); - + break; + case "Celsius": + (ConvertCelsToAll()); + break; + case "Kelvin": + (ConvertKelToAll()); + break; + case "Rankine": + (ConvertRankToAll ()); + } }