Convert Celcius To Fahrenheit

09 May 2020

Problem Statement

The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.

You are given a variable celsius representing a temperature in Celsius. Use the variable fahrenheit already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.

Test Cases

Solution

I Googled the Celsius to Fahrenheit formular to write this program. There isn't much to this program, but I want to make it more useful and fun, which I'll explain next.


function convertToF(celsius) {
  return (celsius * 9/5) + 32;
}

convertToF(30);

Improvement Ideas

It would be cool to add a fahrenheit to celcius converter too, which is a pretty standard improvement.

The more fun idea that I have is to show little facts about different temperatures that are added in. Like '0 degrees represents the freezing point of water', or '100 degrees represents water's boiling point at the standard atmosphere' etc. Maybe even something about how the temperature scale was invented.

What else could make this more fun? Hmm, maybe an oven temperature conversion table, which includes the gas marks vs fan settings.

It would also be fun to have some kind of temperature sensor that tells you how hot your device is too.