Consider the following information about different metrics for temperatures:
Fahrenheit to Celsius: C = (F - 32) * 5/9
Celsius to Fahrenheit: F = (C * 9/5) + 32
Write a program, named ConvertTemperatures. This program must contain two methods, one for converting Fahrenheit to Celsius, and one for converting Celsius to Fahrenheit. Your program should do the following:
Ask the user to enter a temperature in Fahrenheit.
Convert that temperature to Celsius and show that conversion to the user.
Take the Celsius value and convert it back to Fahrenheit, and show that value to the user as well. Is it exactly the same as what the user typed?
Now consider the following length information:
1 foot = 0.3048 meters
1 smoot = 1.7018 meters (What is a smoot? Use the Wikipedia, Luke.)
Armed with this information, write a program, named ConvertLengths, that can convert a measurement in any one of these three units into another. The program must contain one method for each possible conversion. Moreover, some of these methods should rely on others. In other words, don't calculate new conversions yourself; instead, write methods to perform the two conversions above, and then call on those methods to perform other conversions. For example, there's no information above on how to convert feet to smoots, but you could other methods to convert feet to meters, and then meters to smoots within the single method feetToSmoots.
Your interface with the user should look like this:
Enter the original metric: meters Enter the converted metric: furlongs Sorry, I only know feet, meters, and smoots. Try again. Enter the converted metric: smoots Enter the length in meters: Montana Please enter a numeric value. Try again. Enter the length in meters: 5.7 That's 3.3493947 smoots.
Note that you should also write methods to handle user input, checking that the input is valid.
Submit your work like this:
cs11-submit lab-4 ConvertTemperatures.java ConvertLengths.java