Ask Question
31 March, 00:22

Write the pseudocode for the following: A function called fahrenheitToCelsius that accepts a Real Fahrenheit temperature, performs the conversion, and returns the Real Celsius temperature. A function called celsiusToFahrenheit that accepts a Real Celsius temperature, performs the conversion, and returns the Real Fahrenheit temperature. A main module that asks user to enter a Fahrenheit temperature, calls the fahrenheitToCelsius function, and displays the Celsius temperature with a user-friendly message. It then asks the user to enter a Celsius temperature, calls the celsiusToFahrenheit function, and displays the Fahrenheit temperature with a user-friendly message.

+1
Answers (1)
  1. 31 March, 00:30
    0
    import java. util. Scanner;

    public class Main{

    public static float CtoF (float celsius)

    {

    return 9 * (celsius / 5) + 32;

    }

    public static float FtoC (float fahrenheit)

    {

    return (fahrenheit - 32) * 5 / 9;

    }

    public static void main (String []args) {

    System. out. println ("Hello World");

    float temperature;

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter temperature in Fahrenheit");

    temperature = in. nextFloat ();

    System. out. println ("Fahrenheit value = " + FtoC (temperature));

    System. out. println ("Enter temperature in Fahrenheit");

    temperature = in. nextFloat ();

    System. out. println ("Celcius value = " + CtoF (temperature));

    }

    }

    In this program we get input through the scanner object and it needs "java. util. Scanner" header file. We are getting the relevant input and that input is passed on the relevant function which has the ability to convert to Celsius and Fahrenheit.

    Formula:

    To Fahrenheit: 9 * (celsius / 5) + 32;

    To celcius: (fahrenheit - 32) * 5 / 9;
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write the pseudocode for the following: A function called fahrenheitToCelsius that accepts a Real Fahrenheit temperature, performs the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers