37.9k views
0 votes
The formula for converting a temperature from Fahrenheit to Celsius is: C=(5.0/9.0)*(F−32) where F is the Fahrenheit temperature and C is the Celsius temperature. Write a public static method named celsius that accepts a Fahrenheit temperature as an argument and returns that temperature converted to Celsius. The method's parameter should be a double and the method's return type should also be double. (Only write the code for the celsius method. Do not write a complete program or class.)Needed in JAVA

User Rturrado
by
7.4k points

1 Answer

7 votes

Final answer:

The Java method for converting a temperature from Fahrenheit to Celsius accepts a double parameter for the Fahrenheit temperature and returns a double of the Celsius temperature using the conversion formula C = (5.0/9.0) * (F - 32).

Step-by-step explanation:

The student asked to write a public static method in Java that converts temperature from Fahrenheit to Celsius. To achieve this, the following method can be used:

public static double celsius(double F) {
return (5.0 / 9.0) * (F - 32);
}

This method accepts a double representing the Fahrenheit temperature as an argument and returns the converted double Celsius temperature. The conversion is done using the formula C = (5.0/9.0) * (F - 32).

User Abhinsit
by
7.7k points