// Helene Martin, CSE 142 // Converts fahrenheit to celsius. public class Temperatures { public static void main(String[] args) { double nowTemp = 50.6; double tomorrowTemp = 72; // we can either store the result of fToC in a variable or simply use it in // a println double nowTempC = fToC(nowTemp); System.out.println("It's currently " + nowTemp + "F (" + round2(nowTempC) + "C)"); System.out.println("Tomorrow, it will be " + tomorrowTemp + "F (" + round2(fToC(tomorrowTemp)) + "C)"); System.out.println(round2(46.344324324)); } public static double fToC(double tempF) { double result = (5.0 / 9.0 * (tempF - 32)); return result; } public static double round2(double value) { // 46.3423332321 => 4634 => 46.34 double result = Math.round(value * 100) / 100.0; return result; } }