/* Algorithm: Display Celsius 1. Ask the user to enter a temperature in fahrenheit 2. Convert Fahrenheit to Celsius 3. Ask user if they wish to continue 3.1 If no close, if yes continue 4. Done */ import java.util.Scanner; public class ConvertFahToCelMethod{ public static void main(String[] args){ //Initialize cont to be a string, so y or n works String cont = new String("y"); //Initiate scanner to be a scanner Scanner scanner = new Scanner(System.in); //loop until n is printed while(cont != "n"){ //print text & get fahrenheit of the user System.out.print("Enter a temperature in Fahrenheit: "); double fahrenheit = scanner.nextInt(); //Display result & text System.out.print("Your temperature in Celsius is: "+fahToCel(fahrenheit)); //Continue or not? y = yes, n = no System.out.print("Do you want to continue? "); //Ask user if they wish to continue, n = no, y = yes cont = scanner.next(); } } //A double method named fahToCel 1 number received in the main function public static double fahToCel(double num1){ //Do the math double celsius = (num1 - 32)*5/9; //Return the double value/result return celsius; } }