Ask Question
1 June, 07:34

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. 1 June, 10:07
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers