Back to Challenge Set 2

Code Challenge: Temperature

Difficulty  

divider

The Brief

What they asked for
My grandmother still gives me oven temperatures and weather
in Fahrenheit and I have no instinct for it. I want to type
in a Fahrenheit number and get Celsius back, to one decimal
place, not fifteen.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • The formula is Celsius = (Fahrenheit − 32) × 5 ÷ 9. Watch your parentheses.
  • One decimal place is a real requirement here, not a suggestion. Activity 1.9's :F1 is the tool.
  • Test with 32 and 212. If those do not come out as 0.0 and 100.0, the problem is your formula, not your rounding.

Where to Start

Only one-star challenges have this section. If you already know how to begin, skip it — and when you move up to two stars, working out the order yourself is part of the job.

  1. Get the temperature and parse it with double.Parse.
  2. Apply the conversion formula. Look it up if you do not know it.
  3. Print the result, then add :F1.
  4. Check one value you know by hand: 212°F is 100°C.

Sample Output

Sample Output
Fahrenheit: 98.6
98.6 F is 37.0 C

32 F should give 0.0 C and 212 F should give 100.0 C. Check both before you submit.


Submit

Your requirements list and your program file, named cc-temperature.

Commence Challenge