In: Computer Science
The client needs this program written in Java. Your team is tasked to create a program that converts Fahrenheit to Celsius. Fahrenheit temperature of 87.6 degrees. Convert it to Celsius, and display the temperature in both units. Your output should look similar to the following:
Fahrenheit Temperature: 87.6
Celsius Temperature: 30.88
Java program to convert Fahrenheit to Celsius
Code:
public class Main
{
public static void main(String[] args) {
//initializing fahrenheit to 87.6
double fahrenheit=87.6;
//declaring celsius
double celsius;
//converting fahrenheit to celsius
celsius=(( 5 *(fahrenheit - 32.0)) / 9.0);
//printing the results
System.out.println("Fahrenheit Temperature: "+fahrenheit);
System.out.printf("Celsius Temperature: %.2f",celsius);
}
}
Code Screenshot:
Output: