Lab 6: Midterm Aftermath

Since we haven't covered any new material this past week, for this lab you'll have the opportunity to implement and test the final exercise from the midterm exam

Exercise 1: Temperature Conversions

Write a program that prompts the user for a temperature and scale (one of C, F, or K -- for Celsius, Fahrenheit, or Kelvin), and prints out the equivalent temperature in all 3 scales. Note that your program should make use of floating point numbers.

To convert from Fahrenheit to Celsius, use the formula:

F to C

To convert from Celsius to Kelvin, use the formula:

C to K

A sample run of the program follows:

What is the temperature you wish to display?
32
What scale is your temperature in?
F

Result: 0.0C = 32.0F = 273K

Save your work in the file "lab7ex1.rb" and demonstrate it to your TA when ready.