97.7k views
2 votes
write a program that converts a Fahrenheit temperature to Celsius. The design of this program is important as I want you to break your program into separate functions and have the main() function call these to do the work.

User Aaragon
by
5.1k points

1 Answer

4 votes

Answer:

See the code snippet in the explanation section

Step-by-step explanation:

import java.util.Scanner;

public class Question {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

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

int inputTemperature = scan.nextInt();

fahrenheitTemperatureToCelsius(inputTemperature);

}

public static void fahrenheitTemperatureToCelsius(int fahrenheitTemperature){

int celsiusTemperature = ((fahrenheitTemperature - 32)*5)/9;

System.out.println("Temperature in Celsius = " + temperature);

}

}

User VishalPethani
by
5.3k points