

InterviewSolution
Saved Bookmarks
1. |
Write a class that contains the following two methods: i) Public static double CelsiusToFarenheit(double Celsius)- to convert the given Celsius value to its Fahrenheit value. ii) Public static double fahrenheitToCelsius(double Fahrenheit)- to convert given Fahrenheit value to it Celsius value. Use the following formulas for temperature conversion: Fahrenhiet =(9.0/5)*(celsius + 32) Celsius =(5.0/9)*(Fahrenheit-32) Finally invoke these methods from main() method to convert some test values |
Answer» TION:JAVApublic class temperature.{public static void main (String args[]){ FLOAT FAHRENHEIT, Celsius;Celsius= 13;Fahrenheit =((Celsius*9)/5)+32;System.out.println("Temperature in Fahrenheit is: "+Fahrenheit);}} | |