From a3c744ffbb419dd2a3e656c0eea009ae2a22cb71 Mon Sep 17 00:00:00 2001 From: jeremyking1996 <73255406+jeremyking1996@users.noreply.github.com> Date: Mon, 7 Dec 2020 20:39:58 -0500 Subject: [PATCH] all steps done --- .DS_Store | Bin 0 -> 6148 bytes app.js | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 40 +++++++++++++++++ styles.css | 19 +++++++++ 4 files changed, 182 insertions(+) create mode 100644 .DS_Store create mode 100644 app.js create mode 100644 index.html create mode 100644 styles.css diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..77465321016377179679fc715ed8b9cca5ba7ae4 GIT binary patch literal 6148 zcmeHK!EVz)5S>i|tb-6aAhkzdkT^srl?y!}Boop@50wx`Z~)ZWIBG4q-YRj3N=W73 zD1X4G^b7bLc(XfHgu=BdXh)iTv$Hd6?^|ovLquvg%QuL6M5LjNtpLp*gvVJgNlQE( zpyD~qhpaRidOV$%e}MtsyEYYcL_Q|en@^8rm(R1~vY6I`!8g@v zcW&IgrFB<#?{wcMhi0DCX+4_`)5%-zy-4fBOzc<2loxiIy)MS{z23d&rmEAT8c%F; zk&hAb?oCnUW87=$aVry&A4>zO7%VnU~?r%KZ z**`k@wD`O{J##yu@R3@%EBF(>z>wvAOeR%nssng9I-r-dP0wgVyTFH_DgTY8uZa4U zCUm`c20R0vf$PqI9EbY$b$?O+ex3o(z?Cz==R*i(j0GEq_UJ%kO8_AMMp}VwfBu0X zJAkoZ;}9N*a;ZR{ + let farenheitValue= document.querySelector('#tempValue').value; + let output = parseInt(fahrenheitValue) - 32 * 5/9; + celsiusTextVal.innerHTML = output.toFixed(2) + ' C' +}; +function farenheitValue () { + fahrenheitVal.innerHTML = document.querySelector('#tempValue').value + ' F' +}; +let kelvinFarenheit = (userNumber) => { + let farenheitValue= document.querySelector('#tempValue').value + 'K'; + let output = (parseInt(fahrenheitValue) - 32) * 5/9 + 273.15; + kelvinValue.innerHTML = product.toFixed(2) + ' K' +let rankineFarenheit = (userNumber) => { + let fahrenheitValue = document.querySelector('#tempValue').value + let product = (parseInt(fahrenheitValue) + 459.67); + rankineValue.innerHTML = product.toFixed(2) + ' R' +}; + + +// From celsius + +function celsiusValue () { + celsiusTextVal.innerHTML = document.querySelector('#tempBox').value + ' C' +} + +function farenheitCelsius () { + let celsiusInput = document.querySelector('#tempBox').value + let product = (parseInt(celsiusInput) * 9/5) + 32 + fahrenheitTextVal.innerHTML = product.toFixed(2) + ' F' +} + +function kelvinCelsius () { + let celsiusInput = document.querySelector('#tempBox').value + let product = parseInt(celsiusInput) + 273.15 + kelvinTextVal.innerHTML = product.toFixed(2) + ' K' +} + +function rankineCelsius () { + let celsiusInput = document.querySelector('#tempBox').value + let product = parseInt(celsiusInput) * 9/5 + 491.67 + rankineTextVal.innerHTML = product.toFixed(2) + ' R' +} + +// From Kelvin +function kelvinValue () { + kelvinTextVal.innerHTML = document.querySelector('#tempValueBox').value + ' K' +} + +function farenheitKelvin () { + let kelvinInput = document.querySelector('#tempBox').value + let product = (parseInt(kelvinInput) - 273.15) * 9/5 + 32 + fahrenheitTextVal.innerHTML = product.toFixed(2) + ' F' +} + +function celsiusKelvin () { + let kelvinInput = document.querySelector('#tempBox').value + let product = parseInt(kelvinInput) - 273.15 + celsiusTextVal.innerHTML = product.toFixed(2) + ' C' +} + +function rankineKelvin() { + let kelvinInput = document.querySelector('#tempBox').value + let product = parseInt(kelvinInput) * 1.8 + rankineTextVal.innerHTML = product.toFixed(2) + ' R' +} + +// From rankine +function rankineValue () { + rankineTextVal.innerHTML = document.querySelector('#tempBox').value + ' R' +} + +function farenheitRankine () { + let rankineInput = document.querySelector('#tempBox').value + let product = parseInt(rankineInput) - 459.67 + fahrenheitTextVal.innerHTML = product.toFixed(2) + ' F' +} + +function celsiusRankine () { + let rankineInput = document.querySelector('#tempBox').value + let product = (parseInt(rankineInput) - 491.67) * 5/9 + celsiusTextVal.innerHTML = product.toFixed(2) + ' C' +} + +function kelvinRankine () { + let rankineInput = document.querySelector('#tempBox').value + let product = parseInt(rankineInput) * 5/9 + kelvinTextVal.innerHTML = product.toFixed(2) + ' K' +} + +// Determine which formula to use; +function totalConverts () { +if(scale.value === "farenheit"){ + celsiusFarenheit() + rankineFarenheit() + kelvinToFahrenheit() + farenheitValue(); +} else if(scale.value === "celsius"){ + farenheitCelsius() + celsiusValue() + rankineCelsius() + kelvinCelsius(); +} else if(scale.value === "kelvin"){ + kelvinValue() + kelvinFarenheit() + kelvinCelsius() + kelvinRankine(); +} else{ + rankineValue() + farenheitRankine() + celsiusRankine() + kelvinRankine(); +} +} +}; diff --git a/index.html b/index.html new file mode 100644 index 0000000..b8c41e2 --- /dev/null +++ b/index.html @@ -0,0 +1,40 @@ + + + + + + + +
+

Temperature Scale Converter

+ + + + + + + + + +
+ +
Farenheit
+
Celsius
+
Kelvin
+
Rankine
+ + +
+ + + + + + + + \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..005692e --- /dev/null +++ b/styles.css @@ -0,0 +1,19 @@ +.calculator{ + border: solid; + width: 28.125rem; + padding: 5%; +} + +.output { + display: inline; + margin: 5%; +} + +#scale { + margin-bottom: 5%; +} + + +#calcButton { + margin-left: 5%; +} \ No newline at end of file