Write a Java program according to the following specifications: a) The program should ask the user to enter a temperature value in Fahrenheit (your program should display some message, which lets the user know that it is ready for them to enter the temperature value in Fahrenheit). b) The program should call a method named fahToCel and pass the following as an argument to this method: The temperature value entered in step number 3a above in Fahrenheit. c) The method named fahToCel should convert the Fahrenheit temperature value, which has been passed to it, to Celsius and display this Celsius equivalent temperature value (your program should display some message, which lets the user know that the data value displayed is the Celsius equivalent temperature value). d) The program should ask the user to enter a temperature value in Celsius (your program should display some message, which lets the user know that it is ready for them to enter the temperature value in Celsius). e) The program should call a method named celToFah and pass the following as an argument to this method: The temperature value entered in step number 3d above in Celsius. f) The method named celToFah should convert the Celsius temperature value, which has been passed to it, to Fahrenheit and display this Fahrenheit equivalent temperature value (your program should display some message, which lets the user know that the data value displayed is the Fahrenheit equivalent temperature value). For this question, note that temperature values should not be integers and the computations involved in converting from one temperature type to the other do not consist of integer arithmetic operations. Furthermore, the following are the formulae for converting from one temperature type to the other: temperature in Celsius = (temperature in Fahrenheit - 32) times 5/9 temperature in Fahrenheit = 9/5 times temperature in Celsius + 32
import java.util.Arrays; import java.util.Scanner; public class FahrenheitToCelsiumInJava
{
public static void main(String args[]) {
Scanner cmd = new Scanner(System.in); System.out.println(\"Enter temperature in Fahrenheit :\");
float temperatue = cmd.nextFloat(); float celsius = fahtoCel(temperatue);
System.out.printf(\"%.02f degree fahrenheit temperature is equal to %.02f degree celsius %n\", temperatue, celsius); System.out.println(\"Enter temperature in degree celsius :\");
temperatue = cmd.nextFloat();
float fahrenheit = celtoFah(temperatue);
System.out.printf(\"%.02f degree celsius is equal to %.02f degree fahrenheit %n\", temperatue, fahrenheit);
}
public static float celtoFah(float celsius)
{
float fahrenheit = 9 * (celsius / 5) + 32;
return fahrenheit;
}
public static float fahtoCel(float fahrenheit)
{
float celsius = (fahrenheit - 32) * 5 / 9; return celsius;
}
}