Last active
October 22, 2020 09:24
-
-
Save RaynZayd/fba16c1c478a098c783f36567b754599 to your computer and use it in GitHub Desktop.
Kelvin Weather Project Deep in a mountain-side meteorology lab, a mad scientist Kelvin mastered weather prediction. Recently, Kelvin began publishing his weather forecasts on his website. However there’s a problem: All of his forecasts describe the temperature in Kelvin. With the knowledge of JavaScript, I'll convert Kelvin to Celsius, then to F…
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
/*JAVASCRIPT SYNTAX | |
Kelvin Weather Project | |
Deep in a mountain-side meteorology lab, a mad scientist Kelvin mastered weather prediction. | |
Recently, Kelvin began publishing his weather forecasts on his website. However there’s a problem: All of his forecasts describe the temperature in Kelvin. | |
With the knowledge of JavaScript, I'll convert Kelvin to Celsius, then to Fahrenheit. | |
Accomplishments: | |
1.Used console.log and string interpolation to log the temperature in fahrenheit to the console. | |
2.Used the .floor() method from the built-in Math object to round down the Fahrenheit temperature. Saved the result to the fahrenheit variable. | |
3.Used an equation to calculate Fahrenheit, then stored the answer in a variable named fahrenheit.*/ | |
Fahrenheit = Celsius * (9/5) + 32 | |
//Kelvin temperature as a constant var type | |
const kelvin = 293; | |
//Celsius temperature | |
const celsius = kelvin - 273; | |
//Converts celsius to fahrenheit | |
let Fahrenheit = celsius * (9/5) + 32; | |
//Takes the Fahrenheit result and rounds it down | |
var fahrenheit = Math.floor(Fahrenheit); | |
console.log(`The temperature is ${fahrenheit} degress Fahrenheit`); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment